Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

This is the error:

Call to a member function check_capabilities() on a non-object in /home/content/54/11786754/html/wp-includes/class-wp-customize-control.php on line 161

and this is my code in the functions.php

function lmao_customizer_register($wp_customize) {

$wp_customize->add_section('lmao_colors',  array(

    'title' => __('colors', 'lmao'),
    'description' => 'modify the theme colors'

));



$wp_customize->add_setting('background_color',  array(

    'default' => '#fff',
    'type' => 'option' 

));

$wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'background_color',  array(

    'label' => __('Edit Background Color', 'lmao'),
    'section' => 'lmao_colors',
    'settings' => 'background_color'

) ));

$wp_customize->add_setting('link_color',  array(

    'default' => '#fff',
    'type' => 'option' 

));

$wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'link_color',  array(

    'label' => __('Edit link Color', 'lmao'),
    'section' => 'lmao_colors',
    'settings' => 'link_color'

) ));

$wp_customize->add_setting('link_background_color',  array(

    'default' => '#fff',
    'type' => 'option' 

));

$wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'link_background_color',  array(

    'label' => __('Edit link background Color', 'lmao'),
    'section' => 'lmao_colors',
    'settings' => 'link_background_color'

) ));

$wp_customize->add_setting('link_background_color_hover',  array(

    'default' => '#fff',
    'type' => 'option' 

));

$wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'link_background_color_hover',  array(

    'label' => __('Edit link background hover Color', 'lmao'),
    'section' => 'lmao_colors',
    'settings' => 'link_background_color_hover'

) ));

//start image settings
$wp_customize->add_section('lmao_images',  array(

    'title' => __('Images', 'lmao'),
    'description' => 'modify the theme images'


));

$wp_customize->add_setting('main_image',  array(

    'default' => 'http://hottraxstudioproductions.com/rawr/wp-content/uploads/2014/04/radio-logo.jpg',
    'type' => 'option' 

));

$wp_customize->add_control( new WP_Customize_image_Control($wp_customize, 'main_image',  array(

    'label' => __('Edit main image', 'lmao'),
    'section' => 'lmao_images',
    'settings' => 'main_image'

) ));


    //start copyright settings
$wp_customize->add_section('lmao_copyright',  array(

    'title' => __('Copyright_Details', 'lmao'),
    'description' => 'Edit copyright info'

));

$wp_customize->add_setting('Copyright_Details',  array(

    'default' => 'Copyright',
    'type' => 'option' 

));

$wp_customize->add_control('Copyright_Details',  array(

    'label' => __('Edit copyright info', 'lmao'),
    'section' => 'lmao_copyright',
    'settings' => 'copyright_details'

));



}



function lmao_css_customizer() {
?>

<style type="text/css">

    body { background-color: #<?php echo get_theme_mod('background_color'); ?    >;}

    nav ul li a {

        color: <?php echo get_theme_mod('link_color'); ?>;
        background-color: <?php echo get_theme_mod('link_background_color'); ?>;


    }

    nav ul li a:hover {

        background-color: <?php echo get_theme_mod('link_background_color_hover'); ?>;


    }


</style>

<?php



}



add_action('wp_head', 'lmao_css_customizer');
add_action('customize_register', 'LMAO_customizer_register');

Please let me know if you need any more information...

share|improve this question

1 Answer 1

I'm still relatively new to Wordpress Development, but shouldn't this code be in customizer.php, in the "inc" folder(which would be within your active theme's folder)?

Also I know the codex says this particular code is just for the live preview, but after adding it in one of my projects it seemed to fix my issue. So you may need to include these get commands for each section you add in the customizer_register function. For instance, before the first bit of your code, try including:

function lmao_customize_register( $wp_customize ) {
    $wp_customize->get_setting( 'lmao_colors' )->transport='postMessage';
}
add_action( 'customize_register', 'testing_customize_register' );

Then you would begin with adding the section

function lmao_customizer_register($wp_customize) {
    $wp_customize->add_section('lmao_colors',  array(
        'title' => __('colors', 'lmao'),
        'description' => 'modify the theme colors'
));

    $wp_customize->add_setting('background_color',  array(
        'default' => '#fff',
        'type' => 'option' 
));

    $wp_customize->add_control( new WP_Customize_Color_Control($wp_customize, 'background_color',  array(

        'label' => __('Edit Background Color', 'lmao'),
        'section' => 'lmao_colors',
        'settings' => 'background_color'

) ));
}

I hope that is helpful. I'm sorry if not, like I said I'm still new myself, but I wanted to try to make an answer, since it seems you've had this question posted for a while now without response.

Best of luck!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.