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