Is having multiple theme customizers for different pages possible?

This is not a complete solution and the code is not tested, but I it should be enough to give you a general idea of how to use the customizer for different pages.

// Add "Edit page with customizer" link to relevant pages
add_action('admin_bar_menu', function($bar) {
    if (is_home()) {
        $bar->add_node(array(
            'id' => 'some-id-1',
            'title' => 'Edit home page with customizer',
            'href' => admin_url( 'customize.php?url=/home'),
        ));
    }
    else {
        // Same as above, but change url=/home to some other page
        // and possibly add something like &customize-page-id=PAGE_ID
        // so that you can use the page id later.
    }
 });

 // Add customizer settings based on context passed from admin-bar
 add_action( 'customize_register', function() {
     if ($_GET['url'] == '/home') {
         // Add home page customizers
     }
     else {
         // Add other page customizer where setting names are based on
         // $_GET['customize-page-id'] so that to avoid conflicts
     }
 });
});

Leave a Comment