search.php 1.4 KB

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