预先感谢对此的任何帮助,对成员函数check_capabilities()的错误调用
卡在这个车辙里了!
目录布局:
函数像这样调用customize.php:
<?php require_once('functions/customize.php'); ?>customize.php:
<?php
add_action('customize_register', 'adaptive_customize_register');
function adaptive_customize_register($wp_customize) {
//logo
$wp_customize->add_section('adaptive_logo', array(
'title' => __('Add Logo', 'adaptive_framework'),
'description' => __('Upload your main logo, this shows in the header', 'adaptive_framework'),
'priority' => '25'
));
$wp_customize->add_setting('adaptive_custom_settings[add_logo]', array(
'default' => 0,
'type' => 'option'
));
$wp_customize->add_control('adaptive_custom_settings[display_logo]', array(
'label' => __('Display logo?','adaptive_framework'),
'section' => 'adaptive_logo',
'settings' => 'adaptive_custom_settings[display_top_logo]',
'type' => 'checkbox'
));
}
?>如果有人能帮忙,请在我收到错误时,如下所示:
Fatal error: Call to a member function check_capabilities() on a non-object in C:\xampp\htdocs\wordpress\wp-includes\class-wp-customize-control.php on line 160发布于 2013-03-23 16:59:56
必须结束这个线程,因为我现在使用的代码已经不再需要了,我将在一个在线示例中找到完成的代码。
发布于 2014-04-10 07:35:18
add_control()的设置参数必须与add_setting()中定义的设置的名称相匹配。否则,该控件将添加到一个未知设置中,这将导致功能错误。
因此,将adaptive_custom_settings[display_top_logo]更改为adaptive_custom_settings[add_logo]
<?php
add_action('customize_register', 'adaptive_customize_register');
function adaptive_customize_register($wp_customize) {
//logo
$wp_customize->add_section('adaptive_logo', array(
'title' => __('Add Logo', 'adaptive_framework'),
'description' => __('Upload your main logo, this shows in the header', 'adaptive_framework'),
'priority' => '25'
));
$wp_customize->add_setting('adaptive_custom_settings[add_logo]', array(
'default' => 0,
'type' => 'option'
));
$wp_customize->add_control('adaptive_custom_settings[display_logo]', array(
'label' => __('Display logo?','adaptive_framework'),
'section' => 'adaptive_logo',
'settings' => 'adaptive_custom_settings[add_logo]',
'type' => 'checkbox'
));
}
?>https://stackoverflow.com/questions/15311266
复制相似问题