Skip to content

Instantly share code, notes, and snippets.

@jo-snips
Created September 20, 2012 21:17
Show Gist options
  • Select an option

  • Save jo-snips/3758396 to your computer and use it in GitHub Desktop.

Select an option

Save jo-snips/3758396 to your computer and use it in GitHub Desktop.
The Events Calendar: Limit Recurring Event List
<?php
$upcoming = new WP_Query();
$upcoming->query( array(
'post_type' => 'tribe_events',
'eventDisplay' => 'upcoming',
'posts_per_page' => 10,
) );
$postids = Array();
if ($upcoming->have_posts()) :
while ($upcoming->have_posts()) :
$upcoming->the_post();
$thisid = get_the_ID();
if ( !in_array($thisid, $postids)) :
array_push( $postids, $thisid);
?>
<div class="the-event">
<p><?php the_title(); ?></p>
</div>
<?php
endif;
endwhile;
endif;
?>
@codearachnid

Copy link
Copy Markdown

Just fyi you probably should use TribeEvents::POSTTYPE when setting post type for wp_query.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment