Make WordPress Core

Changeset 21398


Ignore:
Timestamp:
08/01/2012 06:52:20 PM (13 years ago)
Author:
lancewillett
Message:

Twenty Twelve: Homepage page template logic cleanup and style updates, props obenland. Fixes #21245.

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

Legend:

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

    r21395 r21398  
    116116        wp_enqueue_style( 'twentytwelve-fonts', "$protocol://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700" );
    117117    }
    118    
     118
    119119    /**
    120120     * Load our main CSS file.
     
    339339 * 1. Using a full-width layout, when no active widgets in the sidebar
    340340 *    or full-width template.
    341  * 2. White or empty background color to change the layout and spacing.
     341 * 2. A thumbnail in the Homepage page template.
     342 * 3. White or empty background color to change the layout and spacing.
    342343 *
    343344 * @since Twenty Twelve 1.0
     
    348349    if ( ! is_active_sidebar( 'sidebar-1' ) || is_page_template( 'full-width-page.php' ) )
    349350        $classes[] = 'full-width';
     351
     352    if ( is_page_template( 'homepage.php' ) && has_post_thumbnail() )
     353        $classes[] = 'has-post-thumbnail';
    350354
    351355    if ( empty( $background_color ) )
  • trunk/wp-content/themes/twentytwelve/homepage.php

    r21261 r21398  
    1313        <div id="content" role="main">
    1414
    15             <div class="home-top">
    16                 <?php while ( have_posts() ) : the_post(); ?>
    17                     <?php if ( has_post_thumbnail() ) { ?>
    18                         <div class="entry-page-image">
    19                             <?php the_post_thumbnail(); ?>
    20                         </div>
    21                     <?php } ?>
    22                     <section class="home-content<?php echo ( has_post_thumbnail() ) ? ' thumbnail' : ''; ?>">
    23                         <div class="entry-content">
    24                             <header class="entry-header">
    25                                 <h1 class="entry-title"><?php the_title(); ?></h1>
    26                             </header><!-- .entry-header -->
    27                             <?php the_content(); ?>
    28                         </div><!-- .entry-content -->
    29                     </section>
    30                 <?php endwhile; // end of the loop. ?>
    31             </div><!-- .home-top -->
     15            <?php while ( have_posts() ) : the_post(); ?>
     16                <?php if ( has_post_thumbnail() ) { ?>
     17                    <div class="entry-page-image">
     18                        <?php the_post_thumbnail(); ?>
     19                    </div>
     20                <?php } ?>
     21
     22                <?php get_template_part( 'content', 'page' ); ?>
     23
     24            <?php endwhile; // end of the loop. ?>
    3225
    3326        </div><!-- #content -->
  • trunk/wp-content/themes/twentytwelve/style.css

    r21397 r21398  
    13191319-------------------------------------------------------------- */
    13201320
     1321.page-template-homepage-php #content article {
     1322    border: 0;
     1323    margin-bottom: 0;
     1324}
    13211325@media screen and (min-width: 600px) {
    1322     div.home-top,
    1323     div.home-middle {
     1326    .page-template-homepage-php #content,
     1327    .page-template-homepage-php article {
    13241328        overflow: hidden;
    13251329    }
    1326 }
    1327 div.home-top {
    1328     margin-bottom: 24px;
    1329     margin-bottom: 1.714285714rem;
    1330 }
    1331 @media screen and (min-width: 600px) {
    1332     section.home-content {
    1333         overflow: hidden;
    1334     }
    1335     section.home-content h1.entry-title {
    1336         margin: 0 0 24px;
    1337         margin: 0 0 1.714285714rem;
    1338     }
    1339     section.home-content.thumbnail {
     1330    .page-template-homepage-php.has-post-thumbnail article {
    13401331        float: left;
    13411332        width: 47.916666667%;
    13421333    }
    1343 }
    1344 @media screen and (min-width: 600px) {
    13451334    .entry-page-image {
    13461335        float: right;
    13471336        width: 47.916666667%;
    1348         margin-bottom: 24px;
    1349         margin-bottom: 1.714285714rem;
    1350     }
    1351 }
    1352 @media screen and (min-width: 600px) {
    1353     .page-template-homepage-php #content {
    1354         overflow: hidden;
    13551337    }
    13561338}
Note: See TracChangeset for help on using the changeset viewer.