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:
ryan 2012-06-06 21:24:22 +00:00
parent 44dc454f53
commit d7a9a9a231
2 changed files with 6 additions and 2 deletions

View File

@ -312,6 +312,7 @@ final class WP_Customize_Manager {
$settings = array( $settings = array(
'values' => array(), 'values' => array(),
'channel' => esc_js( $_POST['customize_messenger_channel'] ), 'channel' => esc_js( $_POST['customize_messenger_channel'] ),
'backgroundImageHasDefault' => current_theme_supports( 'custom-background', 'default-image' ),
); );
foreach ( $this->settings as $id => $setting ) { foreach ( $this->settings as $id => $setting ) {

View File

@ -109,13 +109,14 @@
return; return;
update = function() { update = function() {
var css = ''; var css = '',
hasDefault = api.settings.backgroundImageHasDefault;
// The body will support custom backgrounds if either // The body will support custom backgrounds if either
// the color or image are set. // the color or image are set.
// //
// See get_body_class() in /wp-includes/post-template.php // 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() ) if ( color() )
css += 'background-color: ' + color() + ';'; css += 'background-color: ' + color() + ';';
@ -125,6 +126,8 @@
css += 'background-position: top ' + position_x() + ';'; css += 'background-position: top ' + position_x() + ';';
css += 'background-repeat: ' + repeat() + ';'; css += 'background-repeat: ' + repeat() + ';';
css += 'background-position: top ' + attachment() + ';'; css += 'background-position: top ' + attachment() + ';';
} else if ( hasDefault ) {
css += 'background-image: none;';
} }
// Refresh the stylesheet by removing and recreating it. // Refresh the stylesheet by removing and recreating it.