WordPress.org

Make WordPress Core

Ticket #20448: 20448.7.diff

File 20448.7.diff, 2.0 KB (added by ryan, 6 years ago)

Combined

  • 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_image() || get_background_color() )
    508505                $classes[] = 'custom-background';
    509506
    510507        $page = $wp_query->get( 'page' );
  • wp-includes/theme.php

     
    10631063 * @return string
    10641064 */
    10651065function get_background_image() {
    1066         return get_theme_mod('background_image', get_theme_support( 'custom-background', 'default-image' ) );
     1066        $bg = get_theme_mod('background_image', false );
     1067        if ( false !== $bg )
     1068                return $bg;
     1069
     1070        return sprintf( get_theme_support( 'custom-background', 'default-image' ), get_template_directory_uri(), get_stylesheet_directory_uri() ) ;
    10671071}
    10681072
    10691073/**
     
    11021106 * @access protected
    11031107 */
    11041108function _custom_background_cb() {
    1105         $background = get_theme_mod( 'background_image' );
    1106         $color = get_theme_mod( 'background_color' );
     1109        $background = get_background_image();
     1110        $color = get_background_color();
    11071111
    11081112        if ( ! $background && ! $color )
    11091113                return;
     
    11291133                $attachment = " background-attachment: $attachment;";
    11301134
    11311135                $style .= $image . $repeat . $position . $attachment;
     1136        } else if ( '' === $background && get_theme_support( 'custom-background', 'default-image' ) ) {
     1137                $image = " background-image: none;";
     1138                $style .= $image;
    11321139        }
    11331140?>
    11341141<style type="text/css" id="custom-background-css">