Make WordPress Core

Ticket #20448: 20448.11.diff

File 20448.11.diff, 1.8 KB (added by nacin, 13 years ago)
  • wp-includes/class-wp-customize-manager.php

     
    752752                        'theme_supports' => 'custom-background',
    753753                ) );
    754754
     755                $this->add_setting( 'background_image_has_default', array(
     756                        'default' => (bool) get_theme_support( 'custom-background', 'default-image' ),
     757                        'theme_supports' => 'custom-background',
     758                ) );
     759
    755760                $this->add_control( new WP_Customize_Background_Image_Control( $this ) );
    756761
    757762                $this->add_setting( 'background_repeat', array(
  • wp-includes/js/customize-preview.dev.js

     
    109109                                return;
    110110
    111111                        update = function() {
    112                                 var css = '';
     112                                var css = '', has_default = api.settings.values.background_image_has_default;
    113113
    114114                                // The body will support custom backgrounds if either
    115115                                // the color or image are set.
    116116                                //
    117117                                // See get_body_class() in /wp-includes/post-template.php
    118                                 body.toggleClass( 'custom-background', !! ( color() || image() ) );
     118                                body.toggleClass( 'custom-background', !! ( color() || image() || has_default ) );
    119119
    120120                                if ( color() )
    121121                                        css += 'background-color: ' + color() + ';';
     
    125125                                        css += 'background-position: top ' + position_x() + ';';
    126126                                        css += 'background-repeat: ' + repeat() + ';';
    127127                                        css += 'background-position: top ' + attachment() + ';';
     128                                } else if ( has_default ) {
     129                                        css += 'background-image: none;';
    128130                                }
    129131
    130132                                // Refresh the stylesheet by removing and recreating it.