Advertisement
Guest User

event search results page

a guest
Dec 13th, 2011
61
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None
  1. <?php if ( have_posts() ) : ?>
  2.  
  3.  
  4. <?php
  5.  
  6. $start = time(); //Now
  7. $end= strtotime('+1 month'); //1 month ahead
  8.  
  9. $args = array(
  10. 'post_type' => 'event',
  11. 'post_status' => 'publish',
  12. 'posts_per_page' => '10',
  13. 'meta_query' => array(
  14. array('key' => $prefix.'event_start_timestamp', 'value' => $start, 'compare' => '>=', 'type' => 'NUMERIC'),
  15. array('key' => $prefix.'event_end_timestamp', 'value' => $end, 'compare' => '<=', 'type' => 'NUMERIC')
  16. )
  17. );
  18.  
  19. //new query
  20. $the_query = new WP_Query( $args );
  21. ?>
  22.  
  23. <?php get_template_part( 'post_type', 'event' ); ?>
  24.  
  25. <?php // The loop ?>
  26. <?php while ($the_query->have_posts() ) : $the_query->the_post(); ?>
  27.  
  28.  
  29. <?php endwhile; ?>
  30.  
  31.  
  32. <?php else : ?>
  33.  
  34. <article id="post-0" class="post no-results not-found">
  35. <header class="entry-header">
  36. <h1 class="entry-title"><?php _e( 'Nothing Found', 'eventster' ); ?></h1>
  37. </header><!-- .entry-header -->
  38.  
  39. <div class="entry-content">
  40. <p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'eventster' ); ?></p>
  41. <?php get_search_form(); ?>
  42. </div><!-- .entry-content -->
  43. </article><!-- #post-0 -->
  44.  
  45. <?php endif; ?>
  46.  
Advertisement
RAW Paste Data Copied
Advertisement