I'm working on a wordpress site that keeps track of a series of event
posts (custom post type), and I'd like to split up my archive-event.php
page into two sections – "upcoming events" and "past events," based on today's date.
Using meta_query
, I've been able to successfully show only events which have not yet happened, based on today's date. Changing my query to show past events instead of future ones should not be difficult.
What I don't understand is how to enable both of these queries at the same time. Is there a way to create a second archive-post-type.php
page for my custom post type? Alternatively, is there a way to create a new page template (ex. past-events.php
) and somehow connect add it into the site's template hierarchy?
By way of context, the page I'm trying to modify is here: http://artsrestore.la/events/
And you can see the archive-event.php
code here: https://gist.github.com/egardner/7324310
Many thanks, Eric
Also – I'm pretty new at wordpress and PHP generally, so explanations of code are greatly appreciated!
WP_Query
with according arguments. And don't forget to callwp_reset_postdata
after you're finished, in order you want to work with the original query in some way...