[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

/wp-content/themes/twentytwelve/ -> archive.php (source)

   1  <?php
   2  /**
   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 Twelve already
  10   * has tag.php for Tag archives, category.php for Category archives, and
  11   * author.php for Author archives.
  12   *
  13   * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
  14   *
  15   * @package WordPress
  16   * @subpackage Twenty_Twelve
  17   * @since Twenty Twelve 1.0
  18   */
  19  
  20  get_header(); ?>
  21  
  22      <section id="primary" class="site-content">
  23          <div id="content" role="main">
  24  
  25          <?php if ( have_posts() ) : ?>
  26              <header class="archive-header">
  27                  <h1 class="archive-title">
  28                  <?php
  29                  if ( is_day() ) {
  30                      /* translators: %s: Date. */
  31                      printf( __( 'Daily Archives: %s', 'twentytwelve' ), '<span>' . get_the_date() . '</span>' );
  32                  } elseif ( is_month() ) {
  33                      printf(
  34                          /* translators: %s: Date. */
  35                          __( 'Monthly Archives: %s', 'twentytwelve' ),
  36                          '<span>' . get_the_date( _x( 'F Y', 'monthly archives date format', 'twentytwelve' ) ) . '</span>'
  37                      );
  38                  } elseif ( is_year() ) {
  39                      printf(
  40                          /* translators: %s: Date. */
  41                          __( 'Yearly Archives: %s', 'twentytwelve' ),
  42                          '<span>' . get_the_date( _x( 'Y', 'yearly archives date format', 'twentytwelve' ) ) . '</span>'
  43                      );
  44                  } else {
  45                      _e( 'Archives', 'twentytwelve' );
  46                  }
  47                  ?>
  48                  </h1>
  49              </header><!-- .archive-header -->
  50  
  51              <?php
  52              // Start the Loop.
  53              while ( have_posts() ) :
  54                  the_post();
  55  
  56                  /*
  57                   * Include the post format-specific template for the content. If you want
  58                   * to use this in a child theme then include a file called content-___.php
  59                   * (where ___ is the post format) and that will be used instead.
  60                   */
  61                  get_template_part( 'content', get_post_format() );
  62  
  63              endwhile;
  64  
  65              twentytwelve_content_nav( 'nav-below' );
  66              ?>
  67  
  68          <?php else : ?>
  69              <?php get_template_part( 'content', 'none' ); ?>
  70          <?php endif; ?>
  71  
  72          </div><!-- #content -->
  73      </section><!-- #primary -->
  74  
  75  <?php get_sidebar(); ?>
  76  <?php get_footer(); ?>


Generated : Thu Nov 26 08:20:01 2026 Cross-referenced by PHPXref