Skip to content

Instantly share code, notes, and snippets.

Embed
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() )
{
$events->the_post();
$eventId = $events->ID;
?>
<li>
<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>
</li>
<?
}
echo "</ul>";
} else {
echo "<p>There are no upcoming events available at this time. Visit us again soon!</p>";
}
wp_reset_query();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment