Advertisement
Guest User

Untitled

a guest
May 7th, 2012
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. $startDate = date(  "Y-m-d", strtotime( $startDate ) );
  3. $endDate = date(  "Y-m-d", strtotime( $endDate ) );
  4.  
  5. global $post;
  6.  
  7.  $featured_query = new WP_Query();
  8.  $featured_query->query(
  9.    array(
  10.     'post_type' => 'tribe_events',
  11.     'posts_per_page' => -1,
  12.     'orderby' => 'meta_value',
  13.     'order' => 'ASC',
  14.     'meta_key' => '_EventStartDate',
  15.     'meta_query' => array(
  16.        array(
  17.         'key' => '_EventStartDate',
  18.         'value' => array( $startDate.' 00:00:00', $endDate.' 23:59:59'),
  19.         'type' => 'DATETIME',
  20.         'compare' => 'BETWEEN'
  21.       )
  22.     )
  23.    )
  24.   );
  25.  
  26.  if ($featured_query->have_posts()) :
  27.   while ( $featured_query->have_posts() ) : $featured_query->the_post(); ?>
  28.   <?php global $more; $more = false; ?>
  29.  
  30.  
  31.      //DO WHATEVER YOU NEED TO DO WITH THE POSTS HERE
  32.  
  33.  
  34.   <?php endwhile; ?>
  35.   <?php else: echo  '<h4> Sorry, there are no posts for the selected dates.</h4>'; ?>
  36.  
  37.  <?php endif; ?>
  38.  <?php wp_reset_query();?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement