Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
global $post;
$custom_values = get_post_custom_values( 'event' );
foreach ( $custom_values as $key => $value ) {
$events = get_posts( array(
'post_type' => 'tribe_events',
'posts_per_page' => 50,
'tax_query' => array(
array(
'taxonomy' => 'tribe_events_cat',
'field' => 'slug',
'terms' => $value
)
),
'meta_key' => '_EventEndDate',
'orderby' => 'meta_value',
'order' => 'ASC',
'meta_query' => array(
array(
'key' => '_EventEndDate',
'value' => date('Y-m-d'),
'compare' => '>=',
'type' => 'DATETIME'
)
)
));
// Show the cost, the title, the excerpt from the 1st event.
echo '<span class="event-booking-cost">', tribe_get_cost(), ' &euro;</span>'; // TODO: get cost from (1st) event instead.
the_title('<h3>','</h3>'); // TODO: get title from (1st) event instead.
the_excerpt(); // TODO: get excerpt from (1st) event instead.
// List the events from this category.
if ( empty( $events ) ) {
echo '<p>Nothing found.</p>';
} else {
echo '<ul>';
foreach ( $events as $post ) {
setup_postdata( $post );
echo '<li>';
echo tribe_get_start_date(), ' - ', tribe_get_end_date();
the_title(' (' , ')');
echo '</li>';
//wp_reset_postdata();
//wp_reset_query();
}
echo '</ul>';
} // else
} // foreach
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.