search.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /**
  3. * The template for displaying Search Results pages.
  4. *
  5. * @package Penscratch 2
  6. */
  7. get_header(); ?>
  8. <section id="primary" class="content-area">
  9. <main id="main" class="site-main" role="main">
  10. <?php if ( have_posts() ) : ?>
  11. <header class="page-header">
  12. <h1 class="page-title"><?php printf( esc_html__( 'Search Results for: %s', 'penscratch-2' ), '<span>' . get_search_query() . '</span>' ); ?></h1>
  13. </header><!-- .page-header -->
  14. <?php /* Start the Loop */ ?>
  15. <?php while ( have_posts() ) : the_post(); ?>
  16. <?php
  17. /**
  18. * Run the loop for the search to output the results.
  19. * If you want to overload this in a child theme then include a file
  20. * called content-search.php and that will be used instead.
  21. */
  22. get_template_part( 'content', 'search' );
  23. ?>
  24. <?php endwhile; ?>
  25. <?php the_posts_navigation(); ?>
  26. <?php else : ?>
  27. <?php get_template_part( 'content', 'none' ); ?>
  28. <?php endif; ?>
  29. </main><!-- #main -->
  30. </section><!-- #primary -->
  31. <?php get_sidebar(); ?>
  32. <?php get_footer(); ?>