Last active
February 5, 2021 03:14
-
-
Save harisrozak/2b94e9895fefb3ca4076839f66572f81 to your computer and use it in GitHub Desktop.
WordPress customizer a certain page on accessing a certain section
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
<?php | |
add_action( 'customize_controls_print_scripts', 'custom_customize_controls_print_scripts', 30 ); | |
function custom_customize_controls_print_scripts() { | |
?> | |
<script type='text/javascript'> | |
jQuery( function( $ ) { | |
wp.customize.panel( 'customize_checkout_settings', function( section ) { | |
section.expanded.bind( function( isExpanded ) { | |
if ( isExpanded ) { | |
wp.customize.previewer.previewUrl.set( '<?php echo esc_js( home_url( '/checkout/' ) ) ?>' ); | |
} else { | |
wp.customize.previewer.previewUrl.set( '<?php echo esc_js( home_url() ) ?>' ); | |
} | |
} ) | |
} ); | |
} ); | |
</script> | |
<? | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment