Different customizer previewUrls per section

You could use active_callback property to delegate section visibility depending on current preview screen.

$wp_customize->add_section( 'my-section',
array(
    'title' => __( 'Section Title' ),
    'active_callback' => 'is_shop',
) );

Or custom

$wp_customize->add_section( 'my-section',
array(
    'title' => __( 'Section Title' ),
    'active_callback' => 'is_custom_condition',
) );
function is_custom_condition(){
    $condition_is_met = //Some boolean returning logic;
    if( ! $condition_is_met ){
         return false;
    }
    return true;
}

Leave a Comment