Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $startDate = date( "Y-m-d", strtotime( $startDate ) );
- $endDate = date( "Y-m-d", strtotime( $endDate ) );
- global $post;
- $featured_query = new WP_Query();
- $featured_query->query(
- array(
- 'post_type' => 'tribe_events',
- 'posts_per_page' => -1,
- 'orderby' => 'meta_value',
- 'order' => 'ASC',
- 'meta_key' => '_EventStartDate',
- 'meta_query' => array(
- array(
- 'key' => '_EventStartDate',
- 'value' => array( $startDate.' 00:00:00', $endDate.' 23:59:59'),
- 'type' => 'DATETIME',
- 'compare' => 'BETWEEN'
- )
- )
- )
- );
- if ($featured_query->have_posts()) :
- while ( $featured_query->have_posts() ) : $featured_query->the_post(); ?>
- <?php global $more; $more = false; ?>
- //DO WHATEVER YOU NEED TO DO WITH THE POSTS HERE
- <?php endwhile; ?>
- <?php else: echo '<h4> Sorry, there are no posts for the selected dates.</h4>'; ?>
- <?php endif; ?>
- <?php wp_reset_query();?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement