wp/wp-content/themes/twentyfifteen/archive.php
changeset 8 c7c34916027a
parent 7 cf61fcea0001
child 9 177826044cd9
equal deleted inserted replaced
7:cf61fcea0001 8:c7c34916027a
     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://codex.wordpress.org/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" role="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() ) : the_post();
       
    36 
       
    37 				/*
       
    38 				 * Include the Post-Format-specific template for the content.
       
    39 				 * If you want to override this in a child theme, then include a file
       
    40 				 * called content-___.php (where ___ is the Post Format name) and that will be used instead.
       
    41 				 */
       
    42 				get_template_part( 'content', get_post_format() );
       
    43 
       
    44 			// End the loop.
       
    45 			endwhile;
       
    46 
       
    47 			// Previous/next page navigation.
       
    48 			the_posts_pagination( array(
       
    49 				'prev_text'          => __( 'Previous page', 'twentyfifteen' ),
       
    50 				'next_text'          => __( 'Next page', 'twentyfifteen' ),
       
    51 				'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'twentyfifteen' ) . ' </span>',
       
    52 			) );
       
    53 
       
    54 		// If no content, include the "No posts found" template.
       
    55 		else :
       
    56 			get_template_part( 'content', 'none' );
       
    57 
       
    58 		endif;
       
    59 		?>
       
    60 
       
    61 		</main><!-- .site-main -->
       
    62 	</section><!-- .content-area -->
       
    63 
       
    64 <?php get_footer(); ?>