Theme Customizer: Correctly use custom-background class in theme preview. See #19910.
git-svn-id: https://develop.svn.wordpress.org/trunk@20919 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
e0fc4ce778
commit
b756f8b246
|
@ -81,15 +81,28 @@
|
|||
});
|
||||
|
||||
api.when.apply( api, bg ).done( function( color, image, position_x, repeat, attachment ) {
|
||||
var style = $('#custom-background-css'),
|
||||
var body = $(document.body),
|
||||
style = $('#custom-background-css'),
|
||||
update;
|
||||
|
||||
if ( ! style.length )
|
||||
// If custom backgrounds are active and we can't find the
|
||||
// default output, bail.
|
||||
if ( body.hasClass('custom-background') && ! style.length )
|
||||
return;
|
||||
|
||||
// Create the CSS container if it doesn't already exist.
|
||||
if ( ! style.length )
|
||||
style = $('<style type="text/css" id="custom-background-css" />').appendTo('head');
|
||||
|
||||
update = function() {
|
||||
var css = '';
|
||||
|
||||
// The body will support custom backgrounds if either
|
||||
// the color or image are set.
|
||||
//
|
||||
// See get_body_class() in /wp-includes/post-template.php
|
||||
body.toggleClass( 'custom-background', !! ( color() || image() ) );
|
||||
|
||||
if ( color() )
|
||||
css += 'background-color: #' + color() + ';';
|
||||
|
||||
|
|
Loading…
Reference in New Issue