[ Index ]

PHP Cross Reference of WordPress

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   * Learn more: http://codex.wordpress.org/Template_Hierarchy
   9   *
  10   * @package WordPress
  11   * @subpackage Twenty_Twelve
  12   * @since Twenty Twelve 1.0
  13   */
  14  
  15  get_header(); ?>
  16  
  17      <section id="primary">
  18          <div id="content" role="main">
  19  
  20          <?php if ( have_posts() ) : ?>
  21              <h1 class="archive-title"><?php
  22                  if ( is_day() ) {
  23                      printf( __( 'Daily Archives: %s', 'twentytwelve' ), '<span>' . get_the_date() . '</span>' );
  24                  } elseif ( is_month() ) {
  25                      printf( __( 'Monthly Archives: %s', 'twentytwelve' ), '<span>' . get_the_date( _x( 'F Y', 'monthly archives date format', 'twentytwelve' ) ) . '</span>' );
  26                  } elseif ( is_year() ) {
  27                      printf( __( 'Yearly Archives: %s', 'twentytwelve' ), '<span>' . get_the_date( _x( 'Y', 'yearly archives date format', 'twentytwelve' ) ) . '</span>' );
  28                  } elseif ( is_tag() ) {
  29                      printf( __( 'Tag Archives: %s', 'twentytwelve' ), '<span>' . single_tag_title( '', false ) . '</span>' );
  30                      // Show an optional tag description
  31                      $tag_description = tag_description();
  32                      if ( $tag_description )
  33                          echo apply_filters( 'tag_archive_meta', '<div class="tag-archive-meta">' . $tag_description . '</div>' );
  34                  } elseif ( is_category() ) {
  35                      printf( __( 'Category Archives: %s', 'twentytwelve' ), '<span>' . single_cat_title( '', false ) . '</span>' );
  36                      // Show an optional category description
  37                      $category_description = category_description();
  38                      if ( $category_description )
  39                          echo apply_filters( 'category_archive_meta', '<div class="category-archive-meta">' . $category_description . '</div>' );
  40                  } else {
  41                      _e( 'Blog Archives', 'twentytwelve' );
  42                  }
  43              ?></h1>
  44  
  45              <?php
  46              /* Start the Loop */
  47              while ( have_posts() ) : the_post();
  48  
  49                  /* Include the post format-specific template for the content. If you want to
  50                   * this in a child theme then include a file called called content-___.php
  51                   * (where ___ is the post format) and that will be used instead.
  52                   */
  53                  get_template_part( 'content', get_post_format() );
  54  
  55              endwhile;
  56  
  57              twentytwelve_content_nav( 'nav-below' );
  58              ?>
  59  
  60          <?php else : ?>
  61  
  62              <article id="post-0" class="post no-results not-found">
  63                  <header class="entry-header">
  64                      <h1 class="entry-title"><?php _e( 'Nothing Found', 'twentytwelve' ); ?></h1>
  65                  </header><!-- .entry-header -->
  66  
  67                  <div class="entry-content">
  68                      <p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'twentytwelve' ); ?></p>
  69                      <?php get_search_form(); ?>
  70                  </div><!-- .entry-content -->
  71              </article><!-- #post-0 -->
  72  
  73          <?php endif; ?>
  74  
  75          </div><!-- #content -->
  76      </section><!-- #primary -->
  77  
  78  <?php get_sidebar(); ?>
  79  <?php get_footer(); ?>


Generated: Tue Mar 20 03:55:56 2012 Hosted by follow the white rabbit.