For the first point i have done it with js_vars and value_pattern , but this state doesn’t disappear if i change the toggle
i have tried to write my own script
wp.customize( 'center_header', function( value ) {
value.bind( function( to ) {
$( '.side-header' ).removeClass().addClass( to + ' centered' );
} );
});
But it doesn’t work and i don’t find information on how to accomplish that
-
This reply was modified 7 years, 1 month ago by alexadark.
@alexadark where is that script enqueued?
It should be on customize_preview_init
Hi,
it is:
`add_action( ‘customize_preview_init’, ‘wst_customize_preview_js’ );
/**
* Binds JS handlers to make Theme Customizer preview reload changes asynchronously.
*/
function wst_customize_preview_js() {
wp_enqueue_script( ‘wst-customizer’, get_stylesheet_directory_uri() . ‘/assets/js/theme-customizer.js’, array( ‘customize-preview’ ), ‘1’, true );
}
`
i have this in functions.php and my customizer files are called after this one:
`// Include Kirki custom controls.
require_once( CHILD_THEME_DIR . ‘/lib/customizer/include-kirki.php’ );
// Include Kirki fallback.
require_once( CHILD_THEME_DIR . ‘/lib/customizer/kirki-fallback.php’ );
// WordPress Theme Customizer.
require_once( CHILD_THEME_DIR . ‘/lib/customizer/customizer.php’ );
`
so it should work, i work on a genesis child themes
so normally the code i have written should work ?
-
This reply was modified 7 years, 1 month ago by alexadark.
-
This reply was modified 7 years, 1 month ago by alexadark.
I post an answer but it doesn’t appear
but basically yes
add_action( 'customize_preview_init', 'wst_customize_preview_js' );
/**
* Binds JS handlers to make Theme Customizer preview reload changes asynchronously.
*/
function wst_customize_preview_js() {
wp_enqueue_script( 'wst-customizer', get_stylesheet_directory_uri() . '/assets/js/theme-customizer.js', array( 'customize-preview' ), '1', true );
}
and my customizer files come afte
// Include Kirki custom controls.
require_once( CHILD_THEME_DIR . '/lib/customizer/include-kirki.php' );
// Include Kirki fallback.
require_once( CHILD_THEME_DIR . '/lib/customizer/kirki-fallback.php' );
// WordPress Theme Customizer.
require_once( CHILD_THEME_DIR . '/lib/customizer/customizer.php' );
So the code with add_class etc… should work ?
i am working on a genesis child theme btw
@alexadark I’m sorry for the delay here, I completely missed your reply.
Do you still have an issue with the latest version of the plugin?
Since there has been no reply in 6 weeks I’ll go ahead and close this ticket.
If you’re still having an issue please reopen this and I’ll do my best to reply ASAP.