Make WordPress Core


Ignore:
Timestamp:
08/14/2013 04:38:01 PM (12 years ago)
Author:
lancewillett
Message:

Twenty Fourteen: first pass at matching code standards achieved with Twenty Thirteen development. See #24858, props obenland.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentyfourteen/archive.php

    r24832 r25021  
    22/**
    33 * 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.
    412 *
    513 * Learn more: http://codex.wordpress.org/Template_Hierarchy
     
    1422    <div id="content" class="site-content" role="main">
    1523
    16     <?php if ( have_posts() ) : ?>
     24        <?php if ( have_posts() ) : ?>
    1725
    1826        <header class="page-header">
    1927            <h1 class="page-title">
    2028                <?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() );
    2331
    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' ) );
    2634
    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' ) );
    3837
    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 :
    4939                        _e( 'Archives', 'twentyfourteen' );
    5040
    51                     }
     41                    endif;
    5242                ?>
    5343            </h1>
    54             <?php
    55                 if ( is_category() ) {
    56                     // show an optional category description
    57                     $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 description
    63                     $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             ?>
    6844        </header><!-- .page-header -->
    6945
    70         <?php while ( have_posts() ) : the_post(); ?>
     46        <?php
     47                while ( have_posts() ) :
     48                    the_post();
    7149
    72             <?php twentyfourteen_get_template_part(); ?>
     50                    twentyfourteen_get_template_part();
     51                endwhile;
     52                twentyfourteen_content_nav( 'nav-below' );
    7353
    74         <?php endwhile; ?>
     54            else :
     55                get_template_part( 'no-results', 'archive' );
    7556
    76         <?php twentyfourteen_content_nav( 'nav-below' ); ?>
     57            endif;
     58        ?>
     59    </div><!-- #content -->
     60</section><!-- #primary -->
    7761
    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
     63get_sidebar( 'content' );
     64get_sidebar();
     65get_footer();
Note: See TracChangeset for help on using the changeset viewer.