所以我有这段代码:
<?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:\ Desktop v2 \ XAMPP \ htdocs \ wp-content \ themes \ reconsider \ functions.php中的意外'$ wp_customizer'(T_VARIABLE) “
第50行是:
$wp_customizer->add_section(
可悲的是,我看不到我的语法错误。
**我的所有目录都列为mytheme。*
答案 0 :(得分:0)
从此行的末尾删除下划线:
function mytheme_register_theme_customizer( $wp_customizer ){_
所以它变成了:
function mytheme_register_theme_customizer( $wp_customizer ){