0

Using a child of Twenty Twelve, I've been adding color to all the major containers (#main, #content, #secondary, etc.) using

#arbitrary-id {
 background-color: #dedede;
}

This works for everything but body. I should be more clear: it changed the body background color until I messed with the background color in "Appearance -> Background". Now no matter what I try, I can't override that.

Looking in the HTML of the page and inside the <head> I see:

<style type="text/css" id="custom-background-css">
body.custom-background { background-color: #e6e6e6; }
</style>

Naturally, I tried to change the color using that selector, but since it's generated internally, that trumps the external CSS.

I'm at a total loss for how to do this. How do I change the background color of the body using CSS?

3

It sounds like you just need to remove support for the custom background color.

remove_theme_support( 'custom-background' );

You will probably need to hook it to get it to run after the parent functions.php

function disable_bg_wpse_97248() {
    remove_theme_support( 'custom-background' );
}
add_action('after_setup_theme','disable_bg_wpse_97248',100)
  • That worked perfectly. You are a gentleman and a scholar. I'm very new to all this so I appreciate the full explanation. – Tomulent Apr 25 '13 at 18:09
0

Look in your functions.php for somehting like:

add_theme_support( 'custom-background', array(
    'default-color' => 'e6e6e6',

Remove it, then you can use your CSS to change the background color.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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