我是Wordpress的新手,我已经在functions.php中编写了此代码,以在主题个性化设置中添加一个部分。但是当我尝试打开
http://localhost/Netrad-new/wp-admin/customize.php?return=%2FNetrad-new%2Fwp-admin%2F
要查看结果,我会看到此错误:
致命错误:未捕获错误:在C:\ xampp \ htdocs \ Netrad-new \ wp-includes \ class-wp-customize-> control.php:232上的>字符串上调用成员函数get_setting() >
这是我的 functions.php 代码
function netra_footer_callout($wp_customizer){
$wp_customizer -> add_section('netra_footer_callout_section', array(
'title' => 'Footer Callout'
));
$wp_customizer -> add_setting('netra_footer_callout_headline', array(
'default' => 'Example Headline text!',
'transport' =>'postMessage'
));
$wp_customizer -> add_control(new WP_Customize_Control('$wp_customizer', 'netra_footer_callout_headline_control', array(
'label' => 'Headline',
'section' => 'netra_footer_callout_section',
'settings' => 'netra_footer_callout_headline'
)));
}
add_action('customize_register', 'netra_footer_callout');