-
-
Save herrherrmann/1bf98addf711fcb4d2d9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(), ' €</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