Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Events Loop for The Events Calendar
global $post;
$events = new WP_Query();
$events->query( array('post_type'=> 'tribe_events', 'eventDisplay' => 'all', 'posts_per_page' => 3));
if ( $events->have_posts() ){
echo "<ul>";
while ( $events->have_posts() )
$eventId = $events->ID;
<div class='event-date'><?=tribe_get_start_date($eventId, true, 'l, F d, Y') ?></div>
<h2><a href="<?=tribe_get_event_link($eventId)?>"><? the_title() ?> </a></h2>
<div class='venue-name'><?=tribe_get_venue($eventId)?></div>
<div class='location'><?=tribe_get_city($eventId)?>, <?=tribe_get_state($eventId)?></div>
echo "</ul>";
} else {
echo "<p>There are no upcoming events available at this time. Visit us again soon!</p>";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment