WordPress.org

Make WordPress Core

Ticket #20448: 20448.9.diff

File 20448.9.diff, 2.0 KB (added by nacin, 5 years ago)
  • wp-includes/theme.php

     
    11021102 * @access protected 
    11031103 */ 
    11041104function _custom_background_cb() { 
    1105         $background = get_theme_mod( 'background_image' ); 
     1105        // $background is the saved custom image, or the default image. 
     1106        $background = get_background_image(); 
     1107 
     1108        // $color is the saved custom color. 
     1109        // A default has to be specified in style.css. It will not be printed here. 
    11061110        $color = get_theme_mod( 'background_color' ); 
    11071111 
    1108         if ( ! $background && ! $color ) 
     1112        if ( ! $background && ! $color && ! get_theme_support( 'custom-background', 'default-image' ) ) 
    11091113                return; 
    11101114 
    11111115        $style = $color ? "background-color: #$color;" : ''; 
     
    11291133                $attachment = " background-attachment: $attachment;"; 
    11301134 
    11311135                $style .= $image . $repeat . $position . $attachment; 
     1136        } elseif ( get_theme_support( 'custom-background', 'default-image' ) ) { 
     1137                // If there is not a $background, but there is a default, then the default was 
     1138                // removed and an empty value was saved. Remove it: 
     1139                $style .= " background-image: none;"; 
    11321140        } 
    11331141?> 
    11341142<style type="text/css" id="custom-background-css"> 
  • wp-includes/post-template.php

     
    501501        if ( is_admin_bar_showing() ) 
    502502                $classes[] = 'admin-bar'; 
    503503 
    504         if ( get_theme_mod( 'background_image' ) || get_theme_mod( 'background_color' ) || 
    505                 ( '_custom_background_cb' != get_theme_support( 'custom-background', 'wp-head-callback' ) 
    506                         && ( get_theme_support( 'custom-background', 'default-image' ) || 
    507                                 get_theme_support( 'custom-background', 'default-color' ) ) ) ) 
     504        if ( get_background_color() || get_theme_mod( 'background_image' ) || get_theme_support( 'custom-background', 'default-image' ) ) 
    508505                $classes[] = 'custom-background'; 
    509506 
    510507        $page = $wp_query->get( 'page' );