Currently when viewing a venue page, you get a list of all events that have happened, and will happen there – starting with the oldest. Without selecting the option that basically hides all past events – even on the calendar – is there a way of making that list show future events at the venue first/only, starting with the soonest?
What I want to avoid is where there are so many past events displayed for a venue that every future one is pushed onto page 2 or more.
I don’t mind if past events have to be hidden on venue pages (though I’d rather have a separate list for these if possible) but I don’t want them to disappear of Event Organiser completely.
Thanks in advance, I hope this isn’t too troublesome.
David
Hi David – which version are you using? Selecting that option doesn’t (shouldn’t) hide the past events on the calendars. The text on the settings page I think is out of date – widgets have their own option and the calendar shortcodes show past events by default.
You can, however, use the following code to hide past events:
add_action('pre_get_posts','myprefix_hide_past_events',7);
function myprefix_hide_past_events( $query ){
if( $query->is_main_query() && 'event' == $query->get('post_type') ){
$query->set('showpastevents',false);
}
}
You can optionally apply this to venue / category archive pages only using is_tax()
.
Also you can list past events using eo_get_events()
– and using the appropriate ‘event_start_before’, ‘event_end_before’ attributes where appropriate etc.
The examples on that page are hopefully sufficient to get you started, but if you get stuck feel free to use the forums – and I’ll probably add further examples too.
Stephen Harris