Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Wordpress主题定制器-can';t添加节/设置_Php_Wordpress - Fatal编程技术网

Php Wordpress主题定制器-can';t添加节/设置

Php Wordpress主题定制器-can';t添加节/设置,php,wordpress,Php,Wordpress,我试图通过添加节和设置来修改WorpAddress主题定制器,但无论我在functions.php文件中添加了什么,定制器中都不会显示任何内容 例如: function starter_customize_register( $wp_customize ) { $wp_customize->add_section( 'mytheme_new_section_name' , array( 'title' => __( 'Visible Section Nam

我试图通过添加节和设置来修改WorpAddress主题定制器,但无论我在functions.php文件中添加了什么,定制器中都不会显示任何内容

例如:

function starter_customize_register( $wp_customize ) 
{
    $wp_customize->add_section( 'mytheme_new_section_name' , array(
    'title'      => __( 'Visible Section Name', 'starter' ),
    'priority'   => 30, ) );    
}
add_action( 'customize_register', 'starter_customize_register');
我本以为这会添加一个带有所选名称的部分,但我只看到Wordpress的两个初始部分(站点标题和标语,静态首页)

我在这里找到了一个非常好的教程()。我遵循了每一步,甚至以他们的主题为例,但还是没有显示新的部分或设置

让我怀疑我的配置是否有问题

我正在使用wordpress网络/多站点,不知道这是否相关

有什么想法吗

谢谢 Laurent

您需要添加设置和控件以使其正常工作:

function starter_customize_register( $wp_customize ) 
{
    $wp_customize->add_section( 'starter_new_section_name' , array(
        'title'    => __( 'Visible Section Name', 'starter' ),
        'priority' => 30
    ) );   

    $wp_customize->add_setting( 'starter_new_setting_name' , array(
        'default'   => '#000000',
        'transport' => 'refresh',
    ) );

    $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'link_color', array(
        'label'    => __( 'Header Color', 'starter' ),
        'section'  => 'starter_new_section_name',
        'settings' => 'starter_new_setting_name',
    ) ) );
}
add_action( 'customize_register', 'starter_customize_register');

参考资料:。

另一条备注:主题如Twenty15、twentyforteen等,。。。工作正常,自定义功能也适用于这些功能。非常感谢,在自定义程序中出现某些内容之前,我没有意识到设置和控件也必须存在。请注意,
add\u setting
必须在
add\u control
之前调用。我首先以另一种方式列出了这两个函数(
add\u control
上面的
add\u setting
),但这不起作用。我希望官方文档中有这样一个例子。