Make WordPress Core

Ticket #21226: 21226.diff

File 21226.diff, 2.3 KB (added by lancewillett, 13 years ago)

Make default color #e6e6e6 and handle both white and empty cases

  • wp-content/themes/twentytwelve/style.css

     
    435435        }
    436436}
    437437@media screen and (min-width: 960px) {
    438         body.custom-background #page {
     438        body {
     439                background-color: #e6e6e6;             
     440        }
     441        body #page {
    439442                padding: 0 40px;
    440443                padding: 0 2.857142857rem;
    441444                margin-top: 48px;
     
    446449                -moz-box-shadow: 0 2px 6px rgba(100, 100, 100, 0.3);
    447450                box-shadow: 0 2px 6px rgba(100, 100, 100, 0.3);
    448451        }
     452        body.custom-background-empty {
     453                background-color: #fff;
     454        }
     455        body.custom-background-empty #page,
     456        body.custom-background-white #page {
     457                padding: 0;
     458                margin-top: 0;
     459                margin-bottom: 0;
     460                box-shadow: none;
     461        }
    449462}
    450463#main {
    451464        zoom: 1;
  • wp-content/themes/twentytwelve/functions.php

     
    7171        register_nav_menu( 'primary', __( 'Primary Menu', 'twentytwelve' ) );
    7272
    7373        // Add support for custom background.
    74         add_theme_support( 'custom-background' );
     74        add_theme_support( 'custom-background', array(
     75                'default-color'     => 'e6e6e6',
     76        ) );
    7577
    7678        // Add custom image size for featured image use, displayed on "standard" posts.
    7779        add_theme_support( 'post-thumbnails' );
     
    302304/**
    303305 * Extends the default WordPress body class to denote a full-width layout.
    304306 *
    305  * Used in two cases: no active widgets in sidebar, and full-width page template.
     307 * full-width used for no active widgets in sidebar, and full-width page template.
     308 * white-background used for white custom background color.
    306309 *
    307310 * @since Twenty Twelve 1.0
    308311 */
    309312function twentytwelve_body_class( $classes ) {
     313        $background_color = get_background_color();
     314
    310315        if ( ! is_active_sidebar( 'sidebar-1' ) || is_page_template( 'full-width' ) )
    311316                $classes[] = 'full-width';
    312317
     318        if ( empty( $background_color ) )
     319                $classes[] = 'custom-background-empty';
     320        elseif ( in_array( $background_color, array( 'fff', 'ffffff' ) ) )
     321                $classes[] = 'custom-background-white';
     322
    313323        return $classes;
    314324}
    315325add_filter( 'body_class', 'twentytwelve_body_class' );