Skip to content

Instantly share code, notes, and snippets.

@DannyCooper
Created May 11, 2018 18:52
Show Gist options
  • Save DannyCooper/22068201b5612723a3750853984b4113 to your computer and use it in GitHub Desktop.
Save DannyCooper/22068201b5612723a3750853984b4113 to your computer and use it in GitHub Desktop.
/**
* Scripts to alter the behavior of Customizer controls.
*/
( function( $ ) {
'use strict';
wp.customize.bind( 'ready', function() {
hideFooterSettings();
wp.customize( 'sub-footer-layout', function( value ) {
value.bind( function( newval ) {
hideFooterSettings();
} );
} );
function hideFooterSettings() {
var settingValue = wp.customize.control('sub-footer-layout').setting.get();
if ( settingValue === 'centered' ) {
wp.customize.control('sub-footer-content').container.show();
wp.customize.control('sub-footer-content-left').container.hide();
wp.customize.control('sub-footer-content-right').container.hide();
} else {
wp.customize.control('sub-footer-content').container.hide();
wp.customize.control('sub-footer-content-left').container.show();
wp.customize.control('sub-footer-content-right').container.show();
}
}
} );
}( jQuery ) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment