首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >$wp_customizer T.Variable错误(Wordpress主题定制器)

$wp_customizer T.Variable错误(Wordpress主题定制器)
EN

Stack Overflow用户
提问于 2014-10-29 22:03:09
回答 1查看 52关注 0票数 0

我有一段代码:

代码语言:javascript
复制
<?php
    function mytheme_register_theme_customizer( $wp_customizer ){_

    $wp_customizer->add_section(
        'display_option' ,
        array(
            'title'     => 'Display Options',
            'priority'  => 200

            )
    );

    $wp_customizer->add_setting(
            'index_background_image' ,
            array(
                    'default'   => '' ,
                    'transport' => 'postMessage'
                )

        );

    $wp_customizer->add_control(
        new WP_Customize_Image_Control(
            $wp_customizer,
            'index_background_image',
            array(

                    'label'     => 'Background Image',
                    'section'   => 'display_options',
                    'settings'  => 'background_image'
                )
            )
        );
}
add_action( 'customize_register', 'mytheme_register_theme_customizer' );

?>

因此,在浏览器的localhost上,我得到的结果是:

“分析错误:语法错误,第50行中D:\桌面v2\XAMPP\htdocs\wp-content\themes\reconsider\functions.php中的意外'$wp_customizer‘(T_VARIABLE)”

第50线是:

代码语言:javascript
复制
$wp_customizer->add_section(

遗憾的是,我看不见我的语法错误。

**我所有的目录都被列为我的主题。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-10-29 22:23:36

从该行末尾删除下划线:

代码语言:javascript
复制
function mytheme_register_theme_customizer( $wp_customizer ){_

因此,它变成:

代码语言:javascript
复制
function mytheme_register_theme_customizer( $wp_customizer ){
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26641462

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档