WordPress.org

Make WordPress Core

Changeset 21001


Ignore:
Timestamp:
06/05/12 18:35:31 (6 years ago)
Author:
ryan
Message:

Fix removing the default background image for themes that hard-code the default in css. Honor the default background image for themes that do not provide a fallback in css.

  • <style> will appear if there is a default image registered. This is the same as 3.3.
  • If only a default color is registered, it still assumes it is in the stylesheet, and no <style> will appear. This is a change from 3.3.
  • <style> will continue to appear as before if there is a custom background color or image. This is the same as 3.3.
  • This then allows for a default background image with background-image: none, overriding style.css. This is new.

Props nacin
see #20448

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/post-template.php

    r20973 r21001  
    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 
  • trunk/wp-includes/theme.php

    r20973 r21001  
    11031103 */ 
    11041104function _custom_background_cb() { 
    1105     $background = get_theme_mod( 'background_image' ); 
     1105    $background = get_background_image(); 
    11061106    $color = get_theme_mod( 'background_color' ); 
    11071107 
    1108     if ( ! $background && ! $color ) 
     1108    if ( ! $background && ! $color && ! get_theme_support( 'custom-background', 'default-image' ) ) 
    11091109        return; 
    11101110 
     
    11301130 
    11311131        $style .= $image . $repeat . $position . $attachment; 
     1132    } elseif ( get_theme_support( 'custom-background', 'default-image' ) ) { 
     1133        $style .= " background-image: none;"; 
    11321134    } 
    11331135?> 
Note: See TracChangeset for help on using the changeset viewer.