Don't resurrect a removed default image when changing colors in the Customizer. Props koopersmith, nacin. fixes #20448
git-svn-id: http://core.svn.wordpress.org/trunk@21013 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
44dc454f53
commit
d7a9a9a231
|
@ -312,6 +312,7 @@ final class WP_Customize_Manager {
|
|||
$settings = array(
|
||||
'values' => array(),
|
||||
'channel' => esc_js( $_POST['customize_messenger_channel'] ),
|
||||
'backgroundImageHasDefault' => current_theme_supports( 'custom-background', 'default-image' ),
|
||||
);
|
||||
|
||||
foreach ( $this->settings as $id => $setting ) {
|
||||
|
|
|
@ -109,13 +109,14 @@
|
|||
return;
|
||||
|
||||
update = function() {
|
||||
var css = '';
|
||||
var css = '',
|
||||
hasDefault = api.settings.backgroundImageHasDefault;
|
||||
|
||||
// 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() ) );
|
||||
body.toggleClass( 'custom-background', !! ( color() || image() || hasDefault ) );
|
||||
|
||||
if ( color() )
|
||||
css += 'background-color: ' + color() + ';';
|
||||
|
@ -125,6 +126,8 @@
|
|||
css += 'background-position: top ' + position_x() + ';';
|
||||
css += 'background-repeat: ' + repeat() + ';';
|
||||
css += 'background-position: top ' + attachment() + ';';
|
||||
} else if ( hasDefault ) {
|
||||
css += 'background-image: none;';
|
||||
}
|
||||
|
||||
// Refresh the stylesheet by removing and recreating it.
|
||||
|
|
Loading…
Reference in New Issue