search.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. /**
  3. * The template for displaying search results pages
  4. *
  5. * @link https://developer.wordpress.org/themes/basics/template-hierarchy/#search-result
  6. *
  7. * @package WordPress
  8. * @subpackage Twenty_Nineteen
  9. * @since 1.0.0
  10. */
  11. get_header();
  12. ?>
  13. <div id="primary" class="content-area">
  14. <main id="main" class="site-main">
  15. <?php if ( have_posts() ) : ?>
  16. <header class="page-header">
  17. <h1 class="page-title">
  18. <?php _e( 'Search results for: ', 'twentynineteen' ); ?>
  19. <span class="page-description"><?php echo get_search_query(); ?></span>
  20. </h1>
  21. </header><!-- .page-header -->
  22. <?php
  23. // Start the Loop.
  24. while ( have_posts() ) :
  25. the_post();
  26. /*
  27. * Include the Post-Format-specific template for the content.
  28. * If you want to override this in a child theme, then include a file
  29. * called content-___.php (where ___ is the Post Format name) and that will be used instead.
  30. */
  31. get_template_part( 'template-parts/content/content', 'excerpt' );
  32. // End the loop.
  33. endwhile;
  34. // Previous/next page navigation.
  35. twentynineteen_the_posts_navigation();
  36. // If no content, include the "No posts found" template.
  37. else :
  38. get_template_part( 'template-parts/content/content', 'none' );
  39. endif;
  40. ?>
  41. </main><!-- #main -->
  42. </div><!-- #primary -->
  43. <?php
  44. get_footer();