search.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 Scratchpad
  8. */
  9. get_header(); ?>
  10. <section id="primary" class="content-area">
  11. <main id="main" class="site-main" role="main">
  12. <?php
  13. if ( have_posts() ) : ?>
  14. <header class="page-header">
  15. <h1 class="page-title"><?php printf( esc_html__( 'Search Results for: %s', 'scratchpad' ), '<span>' . get_search_query() . '</span>' ); ?></h1>
  16. </header><!-- .page-header -->
  17. <?php
  18. /* Start the Loop */
  19. while ( have_posts() ) : the_post();
  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( 'template-parts/content', get_post_format() );
  26. endwhile;
  27. the_posts_navigation();
  28. else :
  29. get_template_part( 'template-parts/content', 'none' );
  30. endif; ?>
  31. </main><!-- #main -->
  32. </section><!-- #primary -->
  33. <?php
  34. get_sidebar();
  35. get_footer();