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

Built from https://develop.svn.wordpress.org/trunk@25213


git-svn-id: http://core.svn.wordpress.org/trunk@25184 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Lance Willett 2013-09-02 21:21:09 +00:00
parent 68ebb31a97
commit 01da15c050
11 changed files with 298 additions and 59 deletions

View File

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

View File

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

View File

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

View File

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

View File

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