webdevsuperfast / bootstrap-for-genesis

An awesome Genesis Framework child theme using Bootstrap 4
58 stars 26 forks source link

active_callback in customizer.php #25

Closed steelbridge-io closed 4 years ago

steelbridge-io commented 4 years ago

Hi,

I'm finding the active callback api is not working. When creating a front-page.php and a panel that only shows in the customizer for the Front Page, entering a call back prevents the "Front Page" only panel from showing on any pages. Removing the callback allows the panel to show. I've tested the initial theme in an effort to eliminate any of my additions from the edited version, and it seems to be an issue in the initial theme cloned in my work environment.

'active_callback' => 'is_front_page'

I'm using the above callback for the following and unable to show the panel below in the customizer preview window:

// Add Front Page Section $wp_customize->add_section( 'frontpage', array( 'title' => __( 'Front Page', 'bootstrap-for-genesis' ), 'priority' => 10, 'panel' => 'studio-theme', 'active_callback' => 'is_front_page' ));

webdevsuperfast commented 4 years ago

@steelbridge-io I've tested in on my end and it only shows the Front Page section to only the Front Page not on other pages. Is this the functionality you're looking for? or something else?

// Add Front Page Section 
    $wp_customize->add_section( 'test-section', array( 
        'title' => __( 'Front Page', 'bootstrap-for-genesis' ), 
        'priority' => 40, 
        'panel' => 'bootstrap',
        'active_callback' => 'is_front_page'
    ) );

    $wp_customize->add_setting('test', array(
        'default' => 'testing'
    ) );

    $wp_customize->add_control( 'test', array(
        'type' => 'text',
        'priority' => 30,
        'label' => __( 'Test' ),
        'section' => 'test-section'
    ) );