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

git-svn-id: http://core.svn.wordpress.org/trunk@21398 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
lancewillett 2012-08-01 18:52:20 +00:00
parent 8ed8de23f2
commit cef178b816
3 changed files with 22 additions and 43 deletions

View File

@ -115,7 +115,7 @@ function twentytwelve_scripts_styles() {
$protocol = is_ssl() ? 'https' : 'http';
wp_enqueue_style( 'twentytwelve-fonts', "$protocol://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700" );
}
/**
* Load our main CSS file.
*/
@ -338,7 +338,8 @@ endif;
* 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.
* 2. A thumbnail in the Homepage page template.
* 3. White or empty background color to change the layout and spacing.
*
* @since Twenty Twelve 1.0
*/
@ -348,6 +349,9 @@ function twentytwelve_body_class( $classes ) {
if ( ! is_active_sidebar( 'sidebar-1' ) || is_page_template( 'full-width-page.php' ) )
$classes[] = 'full-width';
if ( is_page_template( 'homepage.php' ) && has_post_thumbnail() )
$classes[] = 'has-post-thumbnail';
if ( empty( $background_color ) )
$classes[] = 'custom-background-empty';
elseif ( in_array( $background_color, array( 'fff', 'ffffff' ) ) )

View File

@ -12,23 +12,16 @@ get_header(); ?>
<div id="primary">
<div id="content" role="main">
<div class="home-top">
<?php while ( have_posts() ) : the_post(); ?>
<?php if ( has_post_thumbnail() ) { ?>
<div class="entry-page-image">
<?php the_post_thumbnail(); ?>
</div>
<?php } ?>
<section class="home-content<?php echo ( has_post_thumbnail() ) ? ' thumbnail' : ''; ?>">
<div class="entry-content">
<header class="entry-header">
<h1 class="entry-title"><?php the_title(); ?></h1>
</header><!-- .entry-header -->
<?php the_content(); ?>
</div><!-- .entry-content -->
</section>
<?php endwhile; // end of the loop. ?>
</div><!-- .home-top -->
<?php while ( have_posts() ) : the_post(); ?>
<?php if ( has_post_thumbnail() ) { ?>
<div class="entry-page-image">
<?php the_post_thumbnail(); ?>
</div>
<?php } ?>
<?php get_template_part( 'content', 'page' ); ?>
<?php endwhile; // end of the loop. ?>
</div><!-- #content -->
</div><!-- #primary -->

View File

@ -1318,40 +1318,22 @@ label ~ span.required {
/* =Home page template styling
-------------------------------------------------------------- */
@media screen and (min-width: 600px) {
div.home-top,
div.home-middle {
overflow: hidden;
}
}
div.home-top {
margin-bottom: 24px;
margin-bottom: 1.714285714rem;
.page-template-homepage-php #content article {
border: 0;
margin-bottom: 0;
}
@media screen and (min-width: 600px) {
section.home-content {
.page-template-homepage-php #content,
.page-template-homepage-php article {
overflow: hidden;
}
section.home-content h1.entry-title {
margin: 0 0 24px;
margin: 0 0 1.714285714rem;
}
section.home-content.thumbnail {
.page-template-homepage-php.has-post-thumbnail article {
float: left;
width: 47.916666667%;
}
}
@media screen and (min-width: 600px) {
.entry-page-image {
float: right;
width: 47.916666667%;
margin-bottom: 24px;
margin-bottom: 1.714285714rem;
}
}
@media screen and (min-width: 600px) {
.page-template-homepage-php #content {
overflow: hidden;
}
}
.page-template-homepage-php #secondary {