I’ve written this code in functions.php to add a section to my theme personalization.
But when I want to open “localhost/wordpress/wp-admin/customize.php?theme=eye-theme” to see my result, I see this error:
Fatal error: Call to a member function
check_capabilities()
on a non-object in C:xampphtdocsxamppwordpresswp-includesclass-wp-customize-control.php on line 233
This is my functions.php:
<?php
function eyetheme_register_theme_customizer($wp_customizer) {
$wp_customizer->add_section(
'eyetheme_display_options',
array(
'title' => 'Display Options',
'priority' => 200
)
);
$wp_customizer->add_setting(
'eyetheme_link_color',
array(
'default' => '#000000',
'transport' => 'postMessage'
)
);
$wp_customizer->add_control(
'eyetheme_link_control',
array(
'section' => 'eyetheme_display_options',
'label' => 'Link Color',
'type' => 'text'
)
);
}
add_action('customize_register', 'eyetheme_register_theme_customizer');
You need to update $wp_customizer->add_setting() method and “settings” parameter in the arguments for $wp_customizer->add_control().
i.e. In your example,
Try this code…