Make WordPress Core

Changeset 21325


Ignore:
Timestamp:
07/25/2012 04:28:50 PM (14 years ago)
Author:
lancewillett
Message:

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.

Location:
trunk/wp-content/themes/twentytwelve
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-content/themes/twentytwelve/functions.php

    r21279 r21325  
    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.
     
    326328
    327329/**
    328  * Extends the default WordPress body class to denote a full-width layout.
    329  * Used when there are no active widgets in the sidebar.
     330 * Extends the default WordPress body class to denote:
     331 * 1. Using a full-width layout, when no active widgets in the sidebar
     332 *    or full-width template.
     333 * 2. White or empty background color to change the layout and spacing.
    330334 *
    331335 * @since Twenty Twelve 1.0
    332336 */
    333337function twentytwelve_body_class( $classes ) {
    334         if ( ! is_active_sidebar( 'sidebar-1' ) || is_page_template( 'full-width' ) )
     338        $background_color = get_background_color();
     339
     340        if ( ! is_active_sidebar( 'sidebar-1' ) || is_page_template( 'full-width-page.php' ) )
    335341                $classes[] = 'full-width';
     342
     343        if ( empty( $background_color ) )
     344                $classes[] = 'custom-background-empty';
     345        elseif ( in_array( $background_color, array( 'fff', 'ffffff' ) ) )
     346                $classes[] = 'custom-background-white';
    336347
    337348        return $classes;
  • trunk/wp-content/themes/twentytwelve/style.css

    r21279 r21325  
    452452}
    453453@media screen and (min-width: 960px) {
    454         body.custom-background #page {
     454        body {
     455                background-color: #e6e6e6;
     456        }
     457        body #page {
    455458                padding: 0 40px;
    456459                padding: 0 2.857142857rem;
     
    462465                -moz-box-shadow: 0 2px 6px rgba(100, 100, 100, 0.3);
    463466                box-shadow: 0 2px 6px rgba(100, 100, 100, 0.3);
     467        }
     468        body.custom-background-empty {
     469                background-color: #fff;
     470        }
     471        body.custom-background-empty #page,
     472        body.custom-background-white #page {
     473                padding: 0;
     474                margin-top: 0;
     475                margin-bottom: 0;
     476                box-shadow: none;
    464477        }
    465478}
Note: See TracChangeset for help on using the changeset viewer.