[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-content/themes/twentyfifteen/ -> 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 one. For example, tag.php (Tag archives),
  10   * category.php (Category archives), author.php (Author archives), etc.
  11   *
  12   * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
  13   *
  14   * @package WordPress
  15   * @subpackage Twenty_Fifteen
  16   * @since Twenty Fifteen 1.0
  17   */
  18  
  19  get_header(); ?>
  20  
  21      <section id="primary" class="content-area">
  22          <main id="main" class="site-main">
  23  
  24          <?php if ( have_posts() ) : ?>
  25  
  26              <header class="page-header">
  27                  <?php
  28                      the_archive_title( '<h1 class="page-title">', '</h1>' );
  29                      the_archive_description( '<div class="taxonomy-description">', '</div>' );
  30                  ?>
  31              </header><!-- .page-header -->
  32  
  33              <?php
  34              // Start the loop.
  35              while ( have_posts() ) :
  36                  the_post();
  37  
  38                  /*
  39                   * Include the post format-specific template for the content. If you want
  40                   * to use this in a child theme, then include a file called content-___.php
  41                   * (where ___ is the post format) and that will be used instead.
  42                   */
  43                  get_template_part( 'content', get_post_format() );
  44  
  45                  // End the loop.
  46              endwhile;
  47  
  48              // Previous/next page navigation.
  49              the_posts_pagination(
  50                  array(
  51                      'prev_text'          => __( 'Previous page', 'twentyfifteen' ),
  52                      'next_text'          => __( 'Next page', 'twentyfifteen' ),
  53                      'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'twentyfifteen' ) . ' </span>',
  54                  )
  55              );
  56  
  57              // If no content, include the "No posts found" template.
  58          else :
  59              get_template_part( 'content', 'none' );
  60  
  61          endif;
  62          ?>
  63  
  64          </main><!-- .site-main -->
  65      </section><!-- .content-area -->
  66  
  67  <?php get_footer(); ?>


Generated: Tue Apr 23 01:00:02 2024 Cross-referenced by PHPXref 0.7.1