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'; $protocol = is_ssl() ? 'https' : 'http';
wp_enqueue_style( 'twentytwelve-fonts', "$protocol://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700" ); wp_enqueue_style( 'twentytwelve-fonts', "$protocol://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700" );
} }
/** /**
* Load our main CSS file. * Load our main CSS file.
*/ */
@ -338,7 +338,8 @@ endif;
* Extends the default WordPress body class to denote: * Extends the default WordPress body class to denote:
* 1. Using a full-width layout, when no active widgets in the sidebar * 1. Using a full-width layout, when no active widgets in the sidebar
* or full-width template. * 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 * @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' ) ) if ( ! is_active_sidebar( 'sidebar-1' ) || is_page_template( 'full-width-page.php' ) )
$classes[] = 'full-width'; $classes[] = 'full-width';
if ( is_page_template( 'homepage.php' ) && has_post_thumbnail() )
$classes[] = 'has-post-thumbnail';
if ( empty( $background_color ) ) if ( empty( $background_color ) )
$classes[] = 'custom-background-empty'; $classes[] = 'custom-background-empty';
elseif ( in_array( $background_color, array( 'fff', 'ffffff' ) ) ) elseif ( in_array( $background_color, array( 'fff', 'ffffff' ) ) )

View File

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

View File

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