Genesis样式选择器导致PHP警告

时间:2015-06-18 作者:laura.f

我正在使用Genesis框架创建自己的儿童主题。我通过以下功能添加了自定义颜色选项:

 add_theme_support( \'genesis-style-selector\', array(
   \'theme-blue\' => __( \'Blue\', \'themename\' ),
   \'theme-green\'    => __( \'Green\', \'themename\' )
 ) );
如果我从WP Admin和Genesis->主题设置中使用它,效果会很好。然而,当我打开customizer时,会收到一条PHP警告。

严格的标准:只有变量应该在D:.中通过引用传递。。。\\wp content\\themes\\genesis\\lib\\admin\\customizer。php在线111

这是第111行附近的一段代码。第111行是以array\\u shift(。。。

$wp_customize->add_control(
        \'genesis_color_scheme\',
        array(
            \'label\'    => __( \'Select Color Style\', \'genesis\'),
            \'section\'  => \'genesis_color_scheme\',
            \'settings\' => $this->get_field_name( \'style_selection\' ),
            \'type\'     => \'select\',
            \'choices\'  => array_merge(
                array( \'\' => __( \'Default\', \'genesis\' ) ),
                array_shift( get_theme_support( \'genesis-style-selector\' ) )
            ),
        )
    );
是什么导致此警告?我如何在不更改Genesis核心文件的情况下使其消失?

1 个回复
最合适的回答,由SO网友:sakibmoon 整理而成

这将删除警告

$selector = get_theme_support( \'genesis-style-selector\' );
$wp_customize->add_control(
    \'genesis_color_scheme\',
    array(
        \'label\'    => __( \'Select Color Style\', \'genesis\'),
        \'section\'  => \'genesis_color_scheme\',
        \'settings\' => $this->get_field_name( \'style_selection\' ),
        \'type\'     => \'select\',
        \'choices\'  => array_merge(
            array( \'\' => __( \'Default\', \'genesis\' ) ),
            array_shift( $selector )
        ),
    )
);

结束

相关推荐

Genesis样式选择器导致PHP警告 - 小码农CODE - 行之有效找到问题解决它

Genesis样式选择器导致PHP警告

时间:2015-06-18 作者:laura.f

我正在使用Genesis框架创建自己的儿童主题。我通过以下功能添加了自定义颜色选项:

 add_theme_support( \'genesis-style-selector\', array(
   \'theme-blue\' => __( \'Blue\', \'themename\' ),
   \'theme-green\'    => __( \'Green\', \'themename\' )
 ) );
如果我从WP Admin和Genesis->主题设置中使用它,效果会很好。然而,当我打开customizer时,会收到一条PHP警告。

严格的标准:只有变量应该在D:.中通过引用传递。。。\\wp content\\themes\\genesis\\lib\\admin\\customizer。php在线111

这是第111行附近的一段代码。第111行是以array\\u shift(。。。

$wp_customize->add_control(
        \'genesis_color_scheme\',
        array(
            \'label\'    => __( \'Select Color Style\', \'genesis\'),
            \'section\'  => \'genesis_color_scheme\',
            \'settings\' => $this->get_field_name( \'style_selection\' ),
            \'type\'     => \'select\',
            \'choices\'  => array_merge(
                array( \'\' => __( \'Default\', \'genesis\' ) ),
                array_shift( get_theme_support( \'genesis-style-selector\' ) )
            ),
        )
    );
是什么导致此警告?我如何在不更改Genesis核心文件的情况下使其消失?

1 个回复
最合适的回答,由SO网友:sakibmoon 整理而成

这将删除警告

$selector = get_theme_support( \'genesis-style-selector\' );
$wp_customize->add_control(
    \'genesis_color_scheme\',
    array(
        \'label\'    => __( \'Select Color Style\', \'genesis\'),
        \'section\'  => \'genesis_color_scheme\',
        \'settings\' => $this->get_field_name( \'style_selection\' ),
        \'type\'     => \'select\',
        \'choices\'  => array_merge(
            array( \'\' => __( \'Default\', \'genesis\' ) ),
            array_shift( $selector )
        ),
    )
);

相关推荐