Genesis theme showing past events on default archives
-
I’m attempting to set up an agenda view using the default archive for events at mysite.com/events (this is a Genesis child theme).
It mostly works great! The events pull in, and the category links also pull in events on the appropriate category. I had two issues: 1) the events were not using the correct order, and 2) past events show up in this view.
The first issue I resolved by modifying the query:
https://gist.github.com/jonschr/c26852dbe62fa3ec251a9a4466e53836The second issue should be resolvable by modifying the query in a similar way. I see what I need; it’s the ‘start’ column – I want to do a meta query which compares ‘start’ to time(), essentially.
Something like this added to the pre_get_posts hook:
$meta_query = array( array( 'key' => 'start', 'value' => time(), 'compare' => '>' ) ); $query->set( 'meta_query', $meta_query );
However, I seem unable to do this sort of meta query because the information is in a nonstandard table (it’s not in the post_meta table, but rather in the sc_events table).
I wondered if you might be able to point me in the right direction.
- The topic ‘Genesis theme showing past events on default archives’ is closed to new replies.