Created
September 8, 2016 13:46
-
-
Save j4ckth3r1pp3r/5f755a6bd275744de79caab37aa12ed7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(function($) { $(document).ready(function() { //загрузка документа | |
//---- Добавляем ссылки подстраниц на главную страницу ACF настроек ----// | |
var linksSettings; | |
var optionPageClass = '.toplevel_page_site-settings '; | |
linksSettings = $(optionPageClass+'.wp-first-item ul').html(); | |
linksSettings = '<ul>'+linksSettings+'</ul>'; | |
$(optionPageClass+'#normal-sortables').append(linksSettings); | |
}); | |
$('ul#adminmenu .wp-first-item ul.wp-submenu .wp-first-item').hide(); | |
//---- Деактивируем поле, если указана галочка ----// | |
function disableField (check, field) { | |
//check - имя чекбокса ACF | |
//field - имя поле ACF, который будет отключаться | |
check = $('div[data-name="'+check+'"] input[type="checkbox"]'); | |
field = $('div[data-name="'+field+'"] input'); | |
if (check.prop('checked')) { | |
field.prop("disabled", true); | |
} else { | |
field.prop("disabled", false); | |
} | |
check.change(function(){ | |
if (field.prop('disabled')) { | |
field.prop("disabled", false); | |
} else { | |
field.prop("disabled", true); | |
} | |
}) | |
} | |
disableField('garanty_lifetime', 'garanty'); | |
disableField('best_price', 'discount_price'); | |
//---- Меняем ширину поля в настройках ACF ----// | |
function changeSizeInput (dataname) { | |
//dataname - имя поля | |
$('div[data-name="'+dataname+'"] div.acf-input').css({"width" : "80px"}); | |
$('div[data-name="'+dataname+'"] div.acf-input input').css({'text-align' : 'right'}); | |
} | |
changeSizeInput('min-meters'); | |
changeSizeInput('max-meters'); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment