How to Conditionally add controls on Theme Customizer panel. Conditional like is_page() or is_page_template() obviously does/will not work because the page is being shown is customize.php.

Code Example

add_action( 'customize_register', 'my_theme_customize_register', 11 );

function my_theme_customize_register($wp_customize){
    if( is_page_template('my-template.php'){
        // add special control

Another observation is, customization setting control panel does not refresh when we switch to pages. It uses ajax to load theme preview. So, I guess theme customizer did not intend to use for post/page specific settings. So, am I hitting a dead end?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.