定制器活动回调不起作用

时间:2016-01-30 作者:Stephen

出于某种原因我active_callback => \'is_front_page\' 不工作,因此没有显示在首页的自定义程序中。我已经将我的首页设置为静态,并在阅读设置中选择了主页。我不知道怎么了。

感谢您的帮助:)

Code:

functions.php

// Customizer
function themeE4K_customize_register( $wp_customize ) {
    // Add Settings
    $wp_customize->add_setting(\'slider_one\', array(
        \'default-image\' => get_template_directory_uri() . \'/assest/imgs/featureProducts/product1.png\',
        \'transport\'     => \'refresh\',
    ));
    $wp_customize->add_setting(\'slider_two\', array(
        \'default-image\' => get_template_directory_uri() . \'/assest/imgs/featureProducts/product1.png\',
        \'transport\'     => \'refresh\',
    ));

    // Add Section
    $wp_customize->add_section(\'slider_image\', array(
        \'title\'           => __(\'Slider Images\', \'e4k-theme\'),
        \'description\'     => __(\'Slider Images for the Home Page of the E4K Theme\'), 
        \'priority\'        => 10,
        \'active_callback\' => \'is_front_page\',
    ));

    // Add Controls
    $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, \'slider_one_control\', array(
        \'label\' => __(\'Slider Image #1\', \'e4k-theme\'),
        \'section\' => \'slider_image\',
        \'settings\' => \'slider_one\',
    )));
    $wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize, \'slider_two_control\', array(
        \'label\' => __(\'Slider Image #2\', \'e4k-theme\'),
        \'section\' => \'slider_image\',
        \'settings\' => \'slider_two\',
    )));    

}
add_action(\'customize_register\', \'themeE4K_customize_register\');

1 个回复
SO网友:cjbj

我已经将你的函数复制粘贴到我的dev安装中,你的两个控件显示在定制器中,都有一个静态首页和一个博客文章首页。

所以有什么事情搞砸了is_front_page 在您的安装中。如果我是你,我会回应the conditions in function 看看那里是否有问题。这可能是一个愚蠢的数据库写入错误。

相关推荐