search.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. /**
  3. * The template for displaying search results pages.
  4. *
  5. * @package Publication
  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', 'publication' ), '<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( 'template-parts/content', 'search' );
  23. ?>
  24. <?php endwhile; ?>
  25. <?php
  26. the_posts_navigation( array(
  27. 'prev_text' => '<span class="meta-nav">' . esc_html__( 'Older posts', 'publication' ) . '</span>',
  28. 'next_text' => '<span class="meta-nav">' . esc_html__( 'Newer posts', 'publication' ) . '</span>',
  29. ) );
  30. ?>
  31. <?php else : ?>
  32. <?php get_template_part( 'template-parts/content', 'none' ); ?>
  33. <?php endif; ?>
  34. </main><!-- #main -->
  35. </section><!-- #primary -->
  36. <?php get_sidebar(); ?>
  37. <?php get_footer(); ?>