This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on May 7th, 2012  |  syntax: PHP  |  size: 0.97 KB  |  views: 79  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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();?>
clone this paste RAW Paste Data