Twenty Fourteen: add archive page templates, fix alignment bugs for archive headers, and use content-none.php for consistency. Props obenland, fixes #25181.

git-svn-id: https://develop.svn.wordpress.org/trunk@25213 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Lance Willett 2013-09-02 21:20:56 +00:00
parent 9c162fa2f2
commit 06d22aed0e
11 changed files with 298 additions and 59 deletions

View File

@ -18,46 +18,46 @@
get_header(); ?> get_header(); ?>
<section id="primary" class="content-area"> <section id="primary" class="content-area">
<div id="content" class="site-content" role="main"> <div id="content" class="site-content" role="main">
<?php if ( have_posts() ) : ?> <?php if ( have_posts() ) : ?>
<header class="page-header"> <header class="page-header">
<h1 class="page-title"> <h1 class="page-title">
<?php <?php
if ( is_day() ) : if ( is_day() ) :
printf( __( 'Day: %s', 'twentyfourteen' ), get_the_date() ); printf( __( 'Day: %s', 'twentyfourteen' ), get_the_date() );
elseif ( is_month() ) : elseif ( is_month() ) :
printf( __( 'Month: %s', 'twentyfourteen' ), get_the_date( 'F Y' ) ); printf( __( 'Month: %s', 'twentyfourteen' ), get_the_date( 'F Y' ) );
elseif ( is_year() ) : elseif ( is_year() ) :
printf( __( 'Year: %s', 'twentyfourteen' ), get_the_date( 'Y' ) ); printf( __( 'Year: %s', 'twentyfourteen' ), get_the_date( 'Y' ) );
else : else :
_e( 'Archives', 'twentyfourteen' ); _e( 'Archives', 'twentyfourteen' );
endif; endif;
?> ?>
</h1> </h1>
</header><!-- .page-header --> </header><!-- .page-header -->
<?php <?php
while ( have_posts() ) : while ( have_posts() ) :
the_post(); the_post();
get_template_part( 'content', get_post_format() ); get_template_part( 'content', get_post_format() );
endwhile; endwhile;
twentyfourteen_paging_nav(); twentyfourteen_paging_nav();
else : else :
get_template_part( 'no-results', 'archive' ); get_template_part( 'content', 'none' );
endif; endif;
?> ?>
</div><!-- #content --> </div><!-- #content -->
</section><!-- #primary --> </section><!-- #primary -->
<?php <?php
get_sidebar( 'content' ); get_sidebar( 'content' );

View File

@ -0,0 +1,65 @@
<?php
/**
* The template for displaying Author archive pages.
*
* Learn more: http://codex.wordpress.org/Template_Hierarchy
*
* @package WordPress
* @subpackage Twenty_Fourteen
*/
get_header(); ?>
<section id="primary" class="content-area">
<div id="content" class="site-content" role="main">
<?php if ( have_posts() ) : ?>
<header class="archive-header">
<h1 class="archive-title">
<?php
/* Queue the first post, that way we know what author
* we're dealing with (if that is the case).
*
* We reset this later so we can run the loop properly
* with a call to rewind_posts().
*/
the_post();
printf( __( 'All posts by %s', 'twentyfourteen' ), sprintf(
'<span class="vcard"><a class="url fn n" href="%1$s" title="%2$s" rel="me">%3$s</a></span>',
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
esc_attr( get_the_author() ),
get_the_author()
) );
?>
</h1>
</header><!-- .archive-header -->
<?php
/* Since we called the_post() above, we need to rewind
* the loop back to the beginning that way we can run
* the loop properly, in full.
*/
rewind_posts();
while ( have_posts() ) :
the_post();
get_template_part( 'content', get_post_format() );
endwhile;
twentyfourteen_paging_nav();
else :
get_template_part( 'content', 'none' );
endif;
?>
</div><!-- #content -->
</section><!-- #primary -->
<?php
get_sidebar( 'content' );
get_sidebar();
get_footer();

View File

@ -0,0 +1,49 @@
<?php
/**
* The template for displaying Category pages.
*
* Learn more: http://codex.wordpress.org/Template_Hierarchy
*
* @package WordPress
* @subpackage Twenty_Fourteen
*/
get_header(); ?>
<section id="primary" class="content-area">
<div id="content" class="site-content" role="main">
<?php if ( have_posts() ) : ?>
<header class="archive-header">
<h1 class="archive-title"><?php single_cat_title(); ?></h1>
<?php
// Show an optional term description.
$term_description = term_description();
if ( ! empty( $term_description ) ) :
printf( '<div class="taxonomy-description">%s</div>', $term_description );
endif;
?>
</header><!-- .archive-header -->
<?php
while ( have_posts() ) :
the_post();
get_template_part( 'content', get_post_format() );
endwhile;
twentyfourteen_paging_nav();
else :
get_template_part( 'content', 'none' );
endif;
?>
</div><!-- #content -->
</section><!-- #primary -->
<?php
get_sidebar( 'content' );
get_sidebar();
get_footer();

View File

@ -31,7 +31,7 @@ get_header(); ?>
twentyfourteen_paging_nav(); twentyfourteen_paging_nav();
else : else :
get_template_part( 'no-results', 'index' ); get_template_part( 'content', 'none' );
endif; endif;
?> ?>

View File

@ -27,7 +27,7 @@ get_header(); ?>
twentyfourteen_paging_nav(); twentyfourteen_paging_nav();
else : else :
get_template_part( 'no-results', 'index' ); get_template_part( 'content', 'none' );
endif; endif;
?> ?>

View File

@ -551,6 +551,7 @@ img.alignleft,
margin: 0 12.5% 0 8.03571428%; margin: 0 12.5% 0 8.03571428%;
} }
.archive-header,
.page-header { .page-header {
margin: 0 12.5% 24px 8.03571428%; margin: 0 12.5% 24px 8.03571428%;
margin: 0 12.5% 2.4rem 8.03571428%; margin: 0 12.5% 2.4rem 8.03571428%;
@ -788,6 +789,7 @@ img.alignleft,
padding-left: 0; padding-left: 0;
} }
.archive-header,
.page-header { .page-header {
margin: 0 12.5% 24px 8.03571428%; margin: 0 12.5% 24px 8.03571428%;
margin: 0 12.5% 2.4rem 8.03571428%; margin: 0 12.5% 2.4rem 8.03571428%;

View File

@ -8,31 +8,31 @@
get_header(); ?> get_header(); ?>
<section id="primary" class="content-area"> <section id="primary" class="content-area">
<div id="content" class="site-content" role="main"> <div id="content" class="site-content" role="main">
<?php if ( have_posts() ) : ?> <?php if ( have_posts() ) : ?>
<header class="page-header"> <header class="page-header">
<h1 class="page-title"><?php printf( __( 'Search Results for: %s', 'twentyfourteen' ), get_search_query() ); ?></h1> <h1 class="page-title"><?php printf( __( 'Search Results for: %s', 'twentyfourteen' ), get_search_query() ); ?></h1>
</header><!-- .page-header --> </header><!-- .page-header -->
<?php <?php
while ( have_posts() ) : while ( have_posts() ) :
the_post(); the_post();
get_template_part( 'content', get_post_format() ); get_template_part( 'content', get_post_format() );
endwhile; endwhile;
twentyfourteen_paging_nav(); twentyfourteen_paging_nav();
else : else :
get_template_part( 'no-results', 'search' ); get_template_part( 'content', 'none' );
endif; endif;
?> ?>
</div><!-- #content --> </div><!-- #content -->
</section><!-- #primary --> </section><!-- #primary -->
<?php <?php
get_sidebar( 'content' ); get_sidebar( 'content' );

View File

@ -1083,14 +1083,12 @@ footer.entry-meta {
} }
/* .content-area specific styles */ /* .content-area specific styles */
.content-area .entry-header, .content-area .entry-header {
.content-area .page-header {
background-color: #fff; background-color: #fff;
padding: 24px 10px 12px; padding: 24px 10px 12px;
padding: 2.4rem 1.0rem 1.2rem; padding: 2.4rem 1.0rem 1.2rem;
} }
.content-area .entry-title, .content-area .entry-title {
.content-area .page-title {
font-size: 33px; font-size: 33px;
font-size: 3.3rem; font-size: 3.3rem;
font-weight: 300; font-weight: 300;
@ -1306,12 +1304,14 @@ footer.entry-meta .entry-title a:hover {
height: 4px; height: 4px;
height: 0.4rem; height: 0.4rem;
} }
.archive-header,
.page-header { .page-header {
margin: 0 0 24px; margin: 0 0 24px;
margin: 0 0 2.4rem; margin: 0 0 2.4rem;
padding: 0 10px; padding: 0 10px;
padding: 0 1.0rem; padding: 0 1.0rem;
} }
.archive-title,
.page-title { .page-title {
font-size: 16px; font-size: 16px;
font-size: 1.6rem; font-size: 1.6rem;
@ -1320,7 +1320,7 @@ footer.entry-meta .entry-title a:hover {
margin-bottom: 24px; margin-bottom: 24px;
margin-bottom: 2.4rem; margin-bottom: 2.4rem;
} }
.taxonomy-description p { .taxonomy-description {
color: #767676; color: #767676;
font-size: 12px; font-size: 12px;
font-size: 1.2rem; font-size: 1.2rem;
@ -2563,6 +2563,7 @@ span > object {
margin: 1.2rem 4.59183673% 2.4rem; margin: 1.2rem 4.59183673% 2.4rem;
padding: 0 4.46428571%; padding: 0 4.46428571%;
} }
.archive-header,
.page-header { .page-header {
margin: 0 4.59183673% 24px; margin: 0 4.59183673% 24px;
margin: 0 4.59183673% 2.4rem; margin: 0 4.59183673% 2.4rem;
@ -2701,6 +2702,7 @@ span > object {
.content-area .full-width footer.entry-meta { .content-area .full-width footer.entry-meta {
margin: 0 11.30926724%; margin: 0 11.30926724%;
} }
.archive-header,
.page-header { .page-header {
margin: 0 8.03571428% 24px 12.5%; margin: 0 8.03571428% 24px 12.5%;
margin: 0 8.03571428% 2.4rem 12.5%; margin: 0 8.03571428% 2.4rem 12.5%;
@ -2826,8 +2828,7 @@ span > object {
margin: 0 0 0 -27.31707317%; margin: 0 0 0 -27.31707317%;
width: 24.87804878%; width: 24.87804878%;
} }
.content-area .entry-header, .content-area .entry-header {
.content-area .page-header {
margin: -48px 4.59183673% 0; margin: -48px 4.59183673% 0;
margin: -4.8rem 4.59183673% 0; margin: -4.8rem 4.59183673% 0;
padding: 24px 4.46428571% 12px; padding: 24px 4.46428571% 12px;
@ -2845,6 +2846,7 @@ span > object {
margin: 1.2rem 4.59183673% 2.4rem; margin: 1.2rem 4.59183673% 2.4rem;
padding: 0 4.46428571%; padding: 0 4.46428571%;
} }
.archive-header,
.page-header { .page-header {
margin: 0 4.59183673% 24px; margin: 0 4.59183673% 24px;
margin: 0 4.59183673% 2.4rem; margin: 0 4.59183673% 2.4rem;
@ -2973,8 +2975,7 @@ span > object {
} }
@media screen and (min-width: 1150px) { @media screen and (min-width: 1150px) {
.content-area .entry-header, .content-area .entry-header {
.content-area .page-header {
margin: -48px 8.03571428% 0 12.5%; margin: -48px 8.03571428% 0 12.5%;
margin: -4.8rem 8.03571428% 0 12.5%; margin: -4.8rem 8.03571428% 0 12.5%;
} }
@ -3009,6 +3010,7 @@ span > object {
.comment-navigation { .comment-navigation {
padding-left: 16.77524429%; padding-left: 16.77524429%;
} }
.archive-header,
.page-header { .page-header {
margin: 0 8.03571428% 24px 12.5%; margin: 0 8.03571428% 24px 12.5%;
margin: 0 8.03571428% 2.4rem 12.5%; margin: 0 8.03571428% 2.4rem 12.5%;

View File

@ -0,0 +1,51 @@
<?php
/**
* The template for displaying Tag pages.
*
* Used to display archive-type pages for posts in a tag.
*
* Learn more: http://codex.wordpress.org/Template_Hierarchy
*
* @package WordPress
* @subpackage Twenty_Fourteen
*/
get_header(); ?>
<section id="primary" class="content-area">
<div id="content" class="site-content" role="main">
<?php if ( have_posts() ) : ?>
<header class="archive-header">
<h1 class="archive-title"><?php single_tag_title();; ?></h1>
<?php
// Show an optional term description.
$term_description = term_description();
if ( ! empty( $term_description ) ) :
printf( '<div class="taxonomy-description">%s</div>', $term_description );
endif;
?>
</header><!-- .archive-header -->
<?php
while ( have_posts() ) :
the_post();
get_template_part( 'content', get_post_format() );
endwhile;
twentyfourteen_paging_nav();
else :
get_template_part( 'content', 'none' );
endif;
?>
</div><!-- #content -->
</section><!-- #primary -->
<?php
get_sidebar( 'content' );
get_sidebar();
get_footer();

View File

@ -0,0 +1,70 @@
<?php
/**
* The template for displaying Post Format pages.
*
* Used to display archive-type pages for posts with a post format.
* If you'd like to further customize these Post Format views, you may create a
* new template file for each specific one.
*
* Learn more: http://codex.wordpress.org/Template_Hierarchy
*
* @package WordPress
* @subpackage Twenty_Fourteen
*/
get_header(); ?>
<section id="primary" class="content-area">
<div id="content" class="site-content" role="main">
<?php if ( have_posts() ) : ?>
<header class="archive-header">
<h1 class="archive-title">
<?php
if ( is_tax( 'post_format', 'post-format-aside' ) ) :
_e( 'Asides', 'twentyfourteen' );
elseif ( is_tax( 'post_format', 'post-format-image' ) ) :
_e( 'Images', 'twentyfourteen');
elseif ( is_tax( 'post_format', 'post-format-video' ) ) :
_e( 'Videos', 'twentyfourteen' );
elseif ( is_tax( 'post_format', 'post-format-quote' ) ) :
_e( 'Quotes', 'twentyfourteen' );
elseif ( is_tax( 'post_format', 'post-format-link' ) ) :
_e( 'Links', 'twentyfourteen' );
elseif ( is_tax( 'post_format', 'post-format-gallery' ) ) :
_e( 'Galleries', 'twentyfourteen' );
else :
_e( 'Archives', 'twentyfourteen' );
endif;
?>
</h1>
</header><!-- .archive-header -->
<?php
while ( have_posts() ) :
the_post();
get_template_part( 'content', get_post_format() );
endwhile;
twentyfourteen_paging_nav();
else :
get_template_part( 'content', 'none' );
endif;
?>
</div><!-- #content -->
</section><!-- #primary -->
<?php
get_sidebar( 'content' );
get_sidebar();
get_footer();