Changeset 25021 for trunk/src/wp-content/themes/twentyfourteen/archive.php
- Timestamp:
- 08/14/2013 04:38:01 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-content/themes/twentyfourteen/archive.php
r24832 r25021 2 2 /** 3 3 * The template for displaying Archive pages. 4 * 5 * Used to display archive-type pages if nothing more specific matches a query. 6 * For example, puts together date-based pages if no date.php file exists. 7 * 8 * If you'd like to further customize these archive views, you may create a 9 * new template file for each specific one. For example, Twenty Fourteen 10 * already has tag.php for Tag archives, category.php for Category archives, 11 * and author.php for Author archives. 4 12 * 5 13 * Learn more: http://codex.wordpress.org/Template_Hierarchy … … 14 22 <div id="content" class="site-content" role="main"> 15 23 16 <?php if ( have_posts() ) : ?>24 <?php if ( have_posts() ) : ?> 17 25 18 26 <header class="page-header"> 19 27 <h1 class="page-title"> 20 28 <?php 21 if ( is_ category() ) {22 printf( __( ' Category Archives: %s', 'twentyfourteen' ), '<span>' . single_cat_title( '', false ) . '</span>');29 if ( is_day() ) : 30 printf( __( 'Day: %s', 'twentyfourteen' ), get_the_date() ); 23 31 24 } elseif ( is_tag() ) {25 printf( __( ' Tag Archives: %s', 'twentyfourteen' ), '<span>' . single_tag_title( '', false ) . '</span>');32 elseif ( is_month() ) : 33 printf( __( 'Month: %s', 'twentyfourteen' ), get_the_date( 'F Y' ) ); 26 34 27 } elseif ( is_author() ) { 28 /* Queue the first post, that way we know 29 * what author we're dealing with (if that is the case). 30 */ 31 the_post(); 32 printf( __( 'Author Archives: %s', 'twentyfourteen' ), '<span class="vcard"><a class="url fn n" href="' . get_author_posts_url( get_the_author_meta( 'ID' ) ) . '" title="' . esc_attr( get_the_author() ) . '" rel="me">' . get_the_author() . '</a></span>' ); 33 /* Since we called the_post() above, we need to 34 * rewind the loop back to the beginning that way 35 * we can run the loop properly, in full. 36 */ 37 rewind_posts(); 35 elseif ( is_year() ) : 36 printf( __( 'Year: %s', 'twentyfourteen' ), get_the_date( 'Y' ) ); 38 37 39 } elseif ( is_day() ) { 40 printf( __( 'Daily Archives: %s', 'twentyfourteen' ), '<span>' . get_the_date() . '</span>' ); 41 42 } elseif ( is_month() ) { 43 printf( __( 'Monthly Archives: %s', 'twentyfourteen' ), '<span>' . get_the_date( 'F Y' ) . '</span>' ); 44 45 } elseif ( is_year() ) { 46 printf( __( 'Yearly Archives: %s', 'twentyfourteen' ), '<span>' . get_the_date( 'Y' ) . '</span>' ); 47 48 } else { 38 else : 49 39 _e( 'Archives', 'twentyfourteen' ); 50 40 51 }41 endif; 52 42 ?> 53 43 </h1> 54 <?php55 if ( is_category() ) {56 // show an optional category description57 $category_description = category_description();58 if ( ! empty( $category_description ) )59 echo apply_filters( 'category_archive_meta', '<div class="taxonomy-description">' . $category_description . '</div>' );60 61 } elseif ( is_tag() ) {62 // show an optional tag description63 $tag_description = tag_description();64 if ( ! empty( $tag_description ) )65 echo apply_filters( 'tag_archive_meta', '<div class="taxonomy-description">' . $tag_description . '</div>' );66 }67 ?>68 44 </header><!-- .page-header --> 69 45 70 <?php while ( have_posts() ) : the_post(); ?> 46 <?php 47 while ( have_posts() ) : 48 the_post(); 71 49 72 <?php twentyfourteen_get_template_part(); ?> 50 twentyfourteen_get_template_part(); 51 endwhile; 52 twentyfourteen_content_nav( 'nav-below' ); 73 53 74 <?php endwhile; ?> 54 else : 55 get_template_part( 'no-results', 'archive' ); 75 56 76 <?php twentyfourteen_content_nav( 'nav-below' ); ?> 57 endif; 58 ?> 59 </div><!-- #content --> 60 </section><!-- #primary --> 77 61 78 <?php else : ?> 79 80 <?php get_template_part( 'no-results', 'archive' ); ?> 81 82 <?php endif; ?> 83 84 </div><!-- #content .site-content --> 85 </section><!-- #primary .content-area --> 86 87 <?php get_sidebar( 'content' ); ?> 88 89 <?php get_sidebar(); ?> 90 91 <?php get_footer(); ?> 62 <?php 63 get_sidebar( 'content' ); 64 get_sidebar(); 65 get_footer();
Note: See TracChangeset
for help on using the changeset viewer.