Twenty Twelve: set gray background as default, handling empty and white as fallback cases. See #21226.

Also fix incorrect logic for full-width-page.php page template check in `twentytwelve_body_class` function.


git-svn-id: http://core.svn.wordpress.org/trunk@21325 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
lancewillett 2012-07-25 16:28:50 +00:00
parent 763685ae9d
commit 90f4303960
2 changed files with 29 additions and 5 deletions

View File

@ -71,7 +71,9 @@ function twentytwelve_setup() {
register_nav_menu( 'primary', __( 'Primary Menu', 'twentytwelve' ) );
// Add support for custom background.
add_theme_support( 'custom-background' );
add_theme_support( 'custom-background', array(
'default-color' => 'e6e6e6',
) );
// Add custom image size for featured image use, displayed on "standard" posts.
add_theme_support( 'post-thumbnails' );
@ -325,15 +327,24 @@ function twentytwelve_entry_meta() {
endif;
/**
* Extends the default WordPress body class to denote a full-width layout.
* Used when there are no active widgets in the sidebar.
* Extends the default WordPress body class to denote:
* 1. Using a full-width layout, when no active widgets in the sidebar
* or full-width template.
* 2. White or empty background color to change the layout and spacing.
*
* @since Twenty Twelve 1.0
*/
function twentytwelve_body_class( $classes ) {
if ( ! is_active_sidebar( 'sidebar-1' ) || is_page_template( 'full-width' ) )
$background_color = get_background_color();
if ( ! is_active_sidebar( 'sidebar-1' ) || is_page_template( 'full-width-page.php' ) )
$classes[] = 'full-width';
if ( empty( $background_color ) )
$classes[] = 'custom-background-empty';
elseif ( in_array( $background_color, array( 'fff', 'ffffff' ) ) )
$classes[] = 'custom-background-white';
return $classes;
}
add_filter( 'body_class', 'twentytwelve_body_class' );

View File

@ -451,7 +451,10 @@ a:hover {
}
}
@media screen and (min-width: 960px) {
body.custom-background #page {
body {
background-color: #e6e6e6;
}
body #page {
padding: 0 40px;
padding: 0 2.857142857rem;
margin-top: 48px;
@ -462,6 +465,16 @@ a:hover {
-moz-box-shadow: 0 2px 6px rgba(100, 100, 100, 0.3);
box-shadow: 0 2px 6px rgba(100, 100, 100, 0.3);
}
body.custom-background-empty {
background-color: #fff;
}
body.custom-background-empty #page,
body.custom-background-white #page {
padding: 0;
margin-top: 0;
margin-bottom: 0;
box-shadow: none;
}
}
#main {
zoom: 1;