search.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. /**
  3. * The template for displaying search results pages.
  4. *
  5. * @package WordPress
  6. * @subpackage Twenty_Fifteen
  7. * @since Twenty Fifteen 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', 'twentyfifteen' ), get_search_query() ); ?></h1>
  15. </header><!-- .page-header -->
  16. <?php
  17. // Start the loop.
  18. while ( have_posts() ) : the_post(); ?>
  19. <?php
  20. /*
  21. * Run the loop for the search to output the results.
  22. * If you want to overload this in a child theme then include a file
  23. * called content-search.php and that will be used instead.
  24. */
  25. get_template_part( 'content', 'search' );
  26. // End the loop.
  27. endwhile;
  28. // Previous/next page navigation.
  29. the_posts_pagination( array(
  30. 'prev_text' => __( 'Previous page', 'twentyfifteen' ),
  31. 'next_text' => __( 'Next page', 'twentyfifteen' ),
  32. 'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'twentyfifteen' ) . ' </span>',
  33. ) );
  34. // If no content, include the "No posts found" template.
  35. else :
  36. get_template_part( 'content', 'none' );
  37. endif;
  38. ?>
  39. </main><!-- .site-main -->
  40. </section><!-- .content-area -->
  41. <?php get_footer(); ?>