Advertisement
Guest User

Untitled

a guest
Oct 12th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.39 KB | None | 0 0
  1. <?php get_header(); ?>
  2. <div class="primary-content">
  3. <div class="container extra-narrow paragraph">
  4. <div id="breadcrumbs">
  5. <a href="<?php echo home_url(); ?>">Home</a>
  6. <i class="fa fa-chevron-right" aria-hidden="true"></i>
  7. <a href="<?php echo $_SERVER['REQUEST_URI']; ?>">Search Results For: "<?php the_search_query(); ?>"</a>
  8. </div>
  9.  
  10. <?php
  11. $args = array(
  12. 'post_type' => 'attachment',
  13. 's' => $_GET['s'],
  14. 'post_status' => 'any',
  15. 'posts_per_page' => -1,
  16. 'post__in' => get_category_resources(0)
  17. );
  18. $resources = new WP_Query($args);
  19.  
  20. $args = array(
  21. 'posts_per_page' => -1,
  22. 'post_type' => 'page',
  23. 's' => $_GET['s']
  24. );
  25. $search_pages = new WP_Query($args);
  26.  
  27. $total_found = $wp_query->found_posts + $resources->found_posts + $search_pages->found_posts;
  28. ?>
  29.  
  30. <div class="grid spacer-bottom stack">
  31. <div class="tile onehalf paragraph short">
  32. <h3>Search Results</h3>
  33. <p><?php echo $total_found; ?> <?php echo $total_found != 1 ? 'Results' : 'Result' ?></p>
  34. </div>
  35. <div class="tile onehalf text-right mobile-text-left">
  36. <div id="search">
  37. <?php get_search_form(); ?>
  38. </div>
  39. </div>
  40. </div>
  41.  
  42. <?php if ( have_posts() ) : ?>
  43. <h5><strong>Products</strong></h5>
  44. <?php while ( have_posts() ) : the_post(); ?>
  45. <?php get_template_part( 'includes/post-preview' ); ?>
  46. <?php endwhile; ?>
  47. <?php endif; ?>
  48.  
  49. <?php if ( $resources->have_posts() ) : ?>
  50. <h5 class="spacer"><strong>Resources</strong></h5>
  51. <?php while ( $resources->have_posts() ) : $resources->the_post(); ?>
  52. <?php get_template_part( 'includes/post-preview' ); ?>
  53. <?php endwhile; wp_reset_postdata(); ?>
  54. <?php endif; ?>
  55.  
  56. <?php if ( $search_pages->have_posts() ) : ?>
  57. <h5 class="spacer"><strong>Pages</strong></h5>
  58. <?php while ( $search_pages->have_posts() ) : $search_pages->the_post(); ?>
  59. <?php get_template_part( 'includes/post-preview' ); ?>
  60. <?php endwhile; wp_reset_postdata(); ?>
  61. <?php endif; ?>
  62. </div>
  63. </div>
  64.  
  65. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement