Custom background fixes:
* Specify default background colors for the bundled themes. * Change the default custom background callback to only operate on saved values, rather than default values. * Prevent an unsaved default value from overriding a manually modified style.css file. Props nacin, kobenland fixes #20448 git-svn-id: https://develop.svn.wordpress.org/trunk@20973 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
585d42c273
commit
b85e8d138c
|
@ -97,8 +97,18 @@ function twentyeleven_setup() {
|
|||
// Add support for a variety of post formats
|
||||
add_theme_support( 'post-formats', array( 'aside', 'link', 'gallery', 'status', 'quote', 'image' ) );
|
||||
|
||||
$theme_options = twentyeleven_get_theme_options();
|
||||
if ( 'dark' == $theme_options['color_scheme'] )
|
||||
$default_background_color = '1d1d1d';
|
||||
else
|
||||
$default_background_color = 'f1f1f1';
|
||||
|
||||
// Add support for custom backgrounds.
|
||||
add_theme_support( 'custom-background' );
|
||||
add_theme_support( 'custom-background', array(
|
||||
// Let WordPress know what our default background color is.
|
||||
// This is dependent on our current color scheme.
|
||||
'default-color' => $default_background_color,
|
||||
) );
|
||||
|
||||
// This theme uses Featured Images (also known as post thumbnails) for per-post/per-page Custom Header images
|
||||
add_theme_support( 'post-thumbnails' );
|
||||
|
|
|
@ -94,7 +94,10 @@ function twentyten_setup() {
|
|||
) );
|
||||
|
||||
// This theme allows users to set a custom background.
|
||||
add_theme_support( 'custom-background' );
|
||||
add_theme_support( 'custom-background', array(
|
||||
// Let WordPress know what our default background color is.
|
||||
'default-color' => 'f1f1f1',
|
||||
) );
|
||||
|
||||
// The custom header business starts here.
|
||||
|
||||
|
|
|
@ -501,7 +501,10 @@ function get_body_class( $class = '' ) {
|
|||
if ( is_admin_bar_showing() )
|
||||
$classes[] = 'admin-bar';
|
||||
|
||||
if ( get_background_image() || get_background_color() )
|
||||
if ( get_theme_mod( 'background_image' ) || get_theme_mod( 'background_color' ) ||
|
||||
( '_custom_background_cb' != get_theme_support( 'custom-background', 'wp-head-callback' )
|
||||
&& ( get_theme_support( 'custom-background', 'default-image' ) ||
|
||||
get_theme_support( 'custom-background', 'default-color' ) ) ) )
|
||||
$classes[] = 'custom-background';
|
||||
|
||||
$page = $wp_query->get( 'page' );
|
||||
|
|
|
@ -1102,8 +1102,9 @@ function background_color() {
|
|||
* @access protected
|
||||
*/
|
||||
function _custom_background_cb() {
|
||||
$background = get_background_image();
|
||||
$color = get_background_color();
|
||||
$background = get_theme_mod( 'background_image' );
|
||||
$color = get_theme_mod( 'background_color' );
|
||||
|
||||
if ( ! $background && ! $color )
|
||||
return;
|
||||
|
||||
|
|
Loading…
Reference in New Issue