First of all – sorry to @roci, I seem to have missed this post.
There are two approaches:
1. Create a page, and use this shortcode. The shortcode takes many attributes, among which are ‘event_end_before’ and ‘event_start_before’. This take relative date/times – so you can have ‘event_end_before’=’now’:
[eo_events event_end_before='now']
Not that it will only consider the date part and is inclusive – i.e. events that end before (or on) today. In 1.5 this will change to consider the time as well.
2. Custom template with a WP_Query()
.
The query can (almost) contain the same arguments as the shortcode can attributes. Certainly the plug-in provided event specific ones. These include ‘event_end_before’ etc.
E.g.:
$events = new WP_Query(array(
'post_type'=>'event',
'post_per_page'=>-1,
'event_end_before'=>'now'
));
if( $events->have_posts() ){
while( $events->have_posts() ): $events->the_post();
//Content of loop
endwhile;
}
wp_reset_postdata();
Alternatively you can use eo_get_events
(a bit like get_posts()
) if you don’t want a loop, but just a list of post objects.
Please note that these aren’t working examples – I’ve not tested them, and they may contain syntax errors.