diff --git a/wp-content/themes/twentytwelve/functions.php b/wp-content/themes/twentytwelve/functions.php index ba24ceb6be..d678aa7316 100644 --- a/wp-content/themes/twentytwelve/functions.php +++ b/wp-content/themes/twentytwelve/functions.php @@ -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' ); diff --git a/wp-content/themes/twentytwelve/style.css b/wp-content/themes/twentytwelve/style.css index e2445aa89e..2af4934aa3 100644 --- a/wp-content/themes/twentytwelve/style.css +++ b/wp-content/themes/twentytwelve/style.css @@ -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;