Thanks in advance for any help with this,
Error Call to a member function check_capabilities()
stuck in a rut with this one!
Directory layout:
- ‘Theme folder’
- functions.php (main directory for ‘Theme’)
- index.php
- style.css
- functions folder (located inside of ‘Theme folder’)
- customize.php
Functions calls customize.php like this:
<?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'
));
}
?>
If anyone can help with please as I get error as follows:
Fatal error: Call to a member function check_capabilities() on a non-object in C:xampphtdocswordpresswp-includesclass-wp-customize-control.php on line 160
The settings parameter of add_control() has to match the name of the setting defined in add_setting(). Otherwise the control is added to an unknown setting which causes the capabilities error.
Therefore change
adaptive_custom_settings[display_top_logo]
toadaptive_custom_settings[add_logo]
Had to end this thread as the code I’m using is now no longer required, I will look to get the finished code as working in an example online.