Note that there are some explanatory texts on larger screens.

plurals
  1. POWordpress theme custom background feature doesn't edit the background correctly
    primarykey
    data
    text
    <p>I'm building a custom Wordpress theme and I'm trying to add the ability to use a custom background through the admin panel. I used the example given <a href="http://codex.wordpress.org/Function_Reference/add_theme_support#Custom_Background" rel="nofollow">here</a> in the WP codex. I'm using WordPress 3.5.2</p> <p>I am getting the background option and it all appears to work fine until I actual view the page. I have noticed that it adds an internal style which refers to a body with class name "custom-background" but the body's actual class is "customize-support". When I adjust these using Chrome's debug it applies the correct styling so is it a bug in a Wordpress function somewhere? I've tried to find where it would give the body that class but can't find anything.</p> <p><strong>functions.php from theme</strong></p> <pre><code> &lt;?php /* * Adds the custom header option to the theme */ function addthemeoptions(){ //Default values of the header image $header_defaults = array( 'default-image' =&gt; '%s/images/header.png', 'random-default' =&gt; false, 'flex-height' =&gt; false, 'flex-width' =&gt; false, 'default-text-color' =&gt; '', 'header-text' =&gt; false, 'uploads' =&gt; true, 'wp-head-callback' =&gt; '', 'admin-head-callback' =&gt; '', 'admin-preview-callback' =&gt; '', ); //Adds the support to use custom header images add_theme_support( 'custom-header', $header_defaults ); $background_defaults = array( 'default-color' =&gt; '#000000', 'default-image' =&gt; '', 'wp-head-callback' =&gt; '_custom_background_cb', 'admin-head-callback' =&gt; '', 'admin-preview-callback' =&gt; '' ); add_theme_support( 'custom-background', $background_defaults ); } //Execute our custom theme functionality add_action( 'after_setup_theme', 'addthemeoptions' ); ?&gt; </code></pre> <p><strong>generated style in head</strong></p> <pre><code>&lt;style type="text/css" id="custom-background-css"&gt; body.custom-background { background-color: #0a0a0a; } &lt;/style&gt; </code></pre> <p><strong>body tag from debug</strong></p> <pre><code>&lt;body class=" customize-support" style&gt; </code></pre> <p>Thanks in advance</p> <p><strong>Edit:</strong> I've found a temporary fix to just add the correct class value into my header.php where body tag is opened but I feel there should be a more complete solution as I'm hard-correcting something that should be generated correctly by a function in WordPress?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload