Custom Background Not Working In WordPress 3.3

  • Published on: 13th December 2011
  • Author:
  • Under: Other
  • Comments: 4

I’ve gotten a couple questions already from people having issues with their custom background options in WordPress after upgrading to WordPress 3.3. In the past I didn’t use the <body_class() ?> function much in my themes as I never really made use of any of the classes added dynamically to the body tag. However, with WorPress 3.3 it is key since now the custom background function makes use of it.

In WordPress 3.3 when you add your custom background instead of applying the styling to your “body” tag as it did before it now adds a new class called “custom-background” and applies the css to that instead.

 

Example:

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

Since it applies the styling to that specific class you will need the custom-background class in your body tag.

The Fix

Open header.php and locate your <body> tag.
Change this value to <body <?php body_class(''); ?>>

Alternative “Fix”

Of course if you don’t want to have the extra classes you can always change the body tag to this (not recommended):

<body class="custom-background">
AJ Clarke
Hey. My name is AJ and I am the boss around here. I own and operate WPExplorer. A website dedicated to everything I love about WordPress.
AJ Clarke
This article has 4 comments
  1. Ozhan says:

    Thank you for this short but great post. I have been struggling with this background problem. Helped a lot.

  2. Catzie says:

    Your alternative fix, though marked as not recommended, saved my day. Thanks.

  3. MarcC says:

    Thank you so much for this fix, scratched my head (and google’s) for long enough trying to fix the custom background image issue.

    Again, thank you.

  4. wordman says:

    Thank you, it’ realy good solve! I’am use and with my template it works! Great.

Leave a Reply