wp/wp-content/themes/twentysixteen/search.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 search results pages
       
     4  *
       
     5  * @package WordPress
       
     6  * @subpackage Twenty_Sixteen
       
     7  * @since Twenty Sixteen 1.0
       
     8  */
       
     9 
       
    10 get_header(); ?>
       
    11 
       
    12 	<section id="primary" class="content-area">
       
    13 		<main id="main" class="site-main" role="main">
       
    14 
       
    15 		<?php if ( have_posts() ) : ?>
       
    16 
       
    17 			<header class="page-header">
       
    18 				<h1 class="page-title"><?php printf( __( 'Search Results for: %s', 'twentysixteen' ), '<span>' . esc_html( get_search_query() ) . '</span>' ); ?></h1>
       
    19 			</header><!-- .page-header -->
       
    20 
       
    21 			<?php
       
    22 			// Start the loop.
       
    23 			while ( have_posts() ) : the_post();
       
    24 
       
    25 				/**
       
    26 				 * Run the loop for the search to output the results.
       
    27 				 * If you want to overload this in a child theme then include a file
       
    28 				 * called content-search.php and that will be used instead.
       
    29 				 */
       
    30 				get_template_part( 'template-parts/content', 'search' );
       
    31 
       
    32 			// End the loop.
       
    33 			endwhile;
       
    34 
       
    35 			// Previous/next page navigation.
       
    36 			the_posts_pagination( array(
       
    37 				'prev_text'          => __( 'Previous page', 'twentysixteen' ),
       
    38 				'next_text'          => __( 'Next page', 'twentysixteen' ),
       
    39 				'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'twentysixteen' ) . ' </span>',
       
    40 			) );
       
    41 
       
    42 		// If no content, include the "No posts found" template.
       
    43 		else :
       
    44 			get_template_part( 'template-parts/content', 'none' );
       
    45 
       
    46 		endif;
       
    47 		?>
       
    48 
       
    49 		</main><!-- .site-main -->
       
    50 	</section><!-- .content-area -->
       
    51 
       
    52 <?php get_sidebar(); ?>
       
    53 <?php get_footer(); ?>