Skip to content

Instantly share code, notes, and snippets.

@harisrozak
Last active February 5, 2021 03:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save harisrozak/2b94e9895fefb3ca4076839f66572f81 to your computer and use it in GitHub Desktop.
Save harisrozak/2b94e9895fefb3ca4076839f66572f81 to your computer and use it in GitHub Desktop.
WordPress customizer a certain page on accessing a certain section
<?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