search.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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 Pen
  8. */
  9. get_header(); ?>
  10. <div id="primary" class="content-area">
  11. <main id="main" class="<?php echo esc_attr( pen_content_classes() ); ?>" role="main">
  12. <div class="pen_article_wrapper">
  13. <?php
  14. if ( have_posts() ) {
  15. ?>
  16. <header class="page-header">
  17. <h1 class="page-title">
  18. <span class="pen_heading_main">
  19. <?php
  20. esc_html_e( 'Search Results for:', 'pen' );
  21. ?>
  22. </span>
  23. <span>
  24. <?php
  25. echo get_search_query(); /* phpcs:ignore */
  26. ?>
  27. </span>
  28. </h1>
  29. </header><!-- .page-header -->
  30. <?php
  31. $content_list_type = pen_list_type();
  32. if ( 'masonry' === $content_list_type ) {
  33. ?>
  34. <div id="pen_masonry">
  35. <?php
  36. }
  37. /* Start the Loop */
  38. while ( have_posts() ) {
  39. the_post();
  40. /**
  41. * Run the loop for the search to output the results.
  42. * If you want to overload this in a child theme then include a file
  43. * called content-search.php and that will be used instead.
  44. */
  45. get_template_part( 'partials/content', 'search' );
  46. }
  47. if ( 'masonry' === $content_list_type ) {
  48. ?>
  49. </div>
  50. <?php
  51. }
  52. get_template_part( 'partials/content', 'pagination' );
  53. } else {
  54. get_template_part( 'partials/content', 'none' );
  55. }
  56. ?>
  57. </div>
  58. </main><!-- #main -->
  59. <?php
  60. if ( ! is_singular() ) {
  61. pen_html_jump_menu( 'list' );
  62. }
  63. ?>
  64. </div><!-- #primary -->
  65. <?php
  66. get_footer();