From d7a9a9a2317dc7fe76095d3cd4d892e6580c0d61 Mon Sep 17 00:00:00 2001 From: ryan Date: Wed, 6 Jun 2012 21:24:22 +0000 Subject: [PATCH] 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 --- wp-includes/class-wp-customize-manager.php | 1 + wp-includes/js/customize-preview.dev.js | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/wp-includes/class-wp-customize-manager.php b/wp-includes/class-wp-customize-manager.php index 0e1ab13a51..15a3508963 100644 --- a/wp-includes/class-wp-customize-manager.php +++ b/wp-includes/class-wp-customize-manager.php @@ -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 ) { diff --git a/wp-includes/js/customize-preview.dev.js b/wp-includes/js/customize-preview.dev.js index 28af66b8dd..15ffc3c542 100644 --- a/wp-includes/js/customize-preview.dev.js +++ b/wp-includes/js/customize-preview.dev.js @@ -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.