Does the customizer support multiple templates?

I only started using the WordPress theme customizer lately and was wondering if it can be used for more than editing the front page.

Is it possible to add a template (or page/post) selector to the left-hand sidebar? Otherwise, can I disable the auto-refresh, so I could still browse the site to see my changes? Needless to say, that I already tried the WordPress Codex.

1 Answer
1

Yes, this is possible. Just add a callback to those mods that you want to appear on specific pages, like this:

$wp_customize->add_control( 'my_page_control', array(
    ...
    'active_callback' => 'is_page',
    ...
    ));

You will see this control in the customizer only if you are viewing a page. Don’t forget to adapt the css produced by this mod in such a way that it only applies to pages as well. More about contextual controls.

Leave a Comment