Make WordPress Core

Changeset 19843


Ignore:
Timestamp:
02/06/2012 10:37:45 PM (15 years ago)
Author:
nacin
Message:

Synchronize archive.php docs with Twenty Eleven. Go easy on the PHP/HTML context switching. see #19978.

File:
1 edited

Legend:

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

    r19842 r19843  
    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 * Learn more: http://codex.wordpress.org/Template_Hierarchy
    49 *
    510 * @package WordPress
     
    1621
    1722                        <header class="page-header">
    18                                 <h1 class="page-title">
    19                                         <?php if ( is_day() ) : ?>
    20                                                 <?php printf( __( 'Daily Archives: %s', 'twentytwelve' ), '<span>' . get_the_date() . '</span>' ); ?>
    21                                         <?php elseif ( is_month() ) : ?>
    22                                                 <?php printf( __( 'Monthly Archives: %s', 'twentytwelve' ), '<span>' . get_the_date( _x( 'F Y', 'monthly archives date format', 'twentytwelve' ) ) . '</span>' ); ?>
    23                                         <?php elseif ( is_year() ) : ?>
    24                                                 <?php printf( __( 'Yearly Archives: %s', 'twentytwelve' ), '<span>' . get_the_date( _x( 'Y', 'yearly archives date format', 'twentytwelve' ) ) . '</span>' ); ?>
    25                                         <?php elseif ( is_tag() ) : ?>
    26                                         <?php
     23                                <h1 class="page-title"><?php
     24                                        if ( is_day() ) {
     25                                                printf( __( 'Daily Archives: %s', 'twentytwelve' ), '<span>' . get_the_date() . '</span>' );
     26                                        } elseif ( is_month() ) {
     27                                                printf( __( 'Monthly Archives: %s', 'twentytwelve' ), '<span>' . get_the_date( _x( 'F Y', 'monthly archives date format', 'twentytwelve' ) ) . '</span>' );
     28                                        } elseif ( is_year() ) {
     29                                                printf( __( 'Yearly Archives: %s', 'twentytwelve' ), '<span>' . get_the_date( _x( 'Y', 'yearly archives date format', 'twentytwelve' ) ) . '</span>' );
     30                                        } elseif ( is_tag() ) {
    2731                                                printf( __( 'Tag Archives: %s', 'twentytwelve' ), '<span>' . single_tag_title( '', false ) . '</span>' );
    2832                                                // Show an optional tag description
    2933                                                $tag_description = tag_description();
    30                                                 if ( ! empty( $tag_description ) )
     34                                                if ( $tag_description )
    3135                                                        echo apply_filters( 'tag_archive_meta', '<div class="tag-archive-meta">' . $tag_description . '</div>' );
    32                                         ?>
    33                                         <?php elseif ( is_category() ) : ?>
    34                                         <?php
     36                                        } elseif ( is_category() ) {
    3537                                                printf( __( 'Category Archives: %s', 'twentytwelve' ), '<span>' . single_cat_title( '', false ) . '</span>' );
    3638                                                // Show an optional category description
    3739                                                $category_description = category_description();
    38                                                 if ( ! empty( $category_description ) )
     40                                                if ( $category_description )
    3941                                                        echo apply_filters( 'category_archive_meta', '<div class="category-archive-meta">' . $category_description . '</div>' );
    40                                         ?>
    41                                         <?php else : ?>
    42                                                 <?php _e( 'Blog Archives', 'twentytwelve' ); ?>
    43                                         <?php endif; ?>
    44                                 </h1>
     42                                        } else {
     43                                                _e( 'Blog Archives', 'twentytwelve' );
     44                                        }
     45                                ?></h1>
    4546                        </header>
    4647
    47                         <?php twentytwelve_content_nav( 'nav-above' ); ?>
     48                        <?php
     49                        twentytwelve_content_nav( 'nav-above' );
     50                       
     51                        /* Start the Loop */
     52                        while ( have_posts() ) : the_post();
    4853
    49                         <?php /* Start the Loop */ ?>
    50                         <?php while ( have_posts() ) : the_post(); ?>
    51                                 <?php get_template_part( 'content', get_post_format() ); ?>
    52                         <?php endwhile; ?>
     54                                /* Include the post format-specific template for the content. If you want to
     55                                 * this in a child theme then include a file called called content-___.php
     56                                 * (where ___ is the post format) and that will be used instead.
     57                                 */
     58                                get_template_part( 'content', get_post_format() );
    5359
    54                         <?php twentytwelve_content_nav( 'nav-below' ); ?>
     60                        endwhile;
     61
     62                        twentytwelve_content_nav( 'nav-below' );
     63                        ?>
    5564
    5665                <?php else : ?>
Note: See TracChangeset for help on using the changeset viewer.