[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

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

   1  <?php
   2  /**
   3   * 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   * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
   9   *
  10   * @package WordPress
  11   * @subpackage Twenty_Eleven
  12   * @since Twenty Eleven 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  
  22                  <header class="page-header">
  23                      <h1 class="page-title">
  24                          <?php
  25                          if ( is_day() ) {
  26                              /* translators: %s: Date. */
  27                              printf( __( 'Daily Archives: %s', 'twentyeleven' ), '<span>' . get_the_date() . '</span>' );
  28                          } elseif ( is_month() ) {
  29                              printf(
  30                                  /* translators: %s: Date. */
  31                                  __( 'Monthly Archives: %s', 'twentyeleven' ),
  32                                  '<span>' . get_the_date( _x( 'F Y', 'monthly archives date format', 'twentyeleven' ) ) . '</span>'
  33                              );
  34                          } elseif ( is_year() ) {
  35                              printf(
  36                                  /* translators: %s: Date. */
  37                                  __( 'Yearly Archives: %s', 'twentyeleven' ),
  38                                  '<span>' . get_the_date( _x( 'Y', 'yearly archives date format', 'twentyeleven' ) ) . '</span>'
  39                              );
  40                          } else {
  41                              _e( 'Blog Archives', 'twentyeleven' );
  42                          }
  43                          ?>
  44                      </h1>
  45                  </header>
  46  
  47                  <?php twentyeleven_content_nav( 'nav-above' ); ?>
  48  
  49                  <?php
  50                  // Start the Loop.
  51                  while ( have_posts() ) :
  52                      the_post();
  53                      ?>
  54  
  55                      <?php
  56                          /*
  57                           * Include the Post-Format-specific template for the content.
  58                           * If you want to overload this in a child theme then include a file
  59                           * called content-___.php (where ___ is the Post Format name) and that
  60                           * will be used instead.
  61                           */
  62                          get_template_part( 'content', get_post_format() );
  63                      ?>
  64  
  65                  <?php endwhile; ?>
  66  
  67                  <?php twentyeleven_content_nav( 'nav-below' ); ?>
  68  
  69              <?php else : ?>
  70  
  71                  <article id="post-0" class="post no-results not-found">
  72                      <header class="entry-header">
  73                          <h1 class="entry-title"><?php _e( 'Nothing Found', 'twentyeleven' ); ?></h1>
  74                      </header><!-- .entry-header -->
  75  
  76                      <div class="entry-content">
  77                          <p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'twentyeleven' ); ?></p>
  78                          <?php get_search_form(); ?>
  79                      </div><!-- .entry-content -->
  80                  </article><!-- #post-0 -->
  81  
  82              <?php endif; ?>
  83  
  84              </div><!-- #content -->
  85          </section><!-- #primary -->
  86  
  87  <?php get_sidebar(); ?>
  88  <?php get_footer(); ?>


Generated : Thu Dec 3 08:20:02 2026 Cross-referenced by PHPXref