Posted: January 24, 2022 at 10:04 pm
Currently I have setup a query modifier using the WordPress hook
where I have added the ability to sort the posts on the archive page by their event espresso start date.
Now I would like to modify this function to also remove events that have expired from displaying on the archive page for the taxonomy
Any thoughts on how to do this?
Can you link me to the output you are referring to, please?
@Tony You can see it here https://nrtraininggroup.com/event-category/electro-cert/
Currently we have removed expired events but we would not like to remove expired events from our backend, instead adjust the query for posts to remove expired events.
Are you aware we have a section within Event Espresso to enable/disable expired events on event lists?
Event Espresso -> Events -> Template -> Event list pages.
Set ‘Display Expired Events’ to No and save.
That change affects all frontend auto-generated event lists (and the [ESPRESSO_EVENTS] shortcode)
With regards to the code you are using above, the posts should already be sorted by Event Start ASC, are you sure that code is running?
The reason I ask is the dot notation you are using relates to our model system and I don’t think it will work directly with
Yes, that is checked.
Yes the code does have an effect, I can share with you two screenshots, one with the code and one without the code.
With the code in place: https://ibb.co/S6rws19
Without the code in place: https://ibb.co/rxTj2n0
Hmm, sounds like something else is happening here then as it should change that output.
Yeah, again that’s odd.
Are you using a custom template in your theme for the taxonomy archive?
Can you send me a copy of the theme to have a look locally?
The output on the taxonomy archive for me locally is very different from what you have.
Schoolboy error on my part for the code you are using above, it will work on EE events as EE hooks in and handles the joins already for output queries so adding the above will indeed order them as expected.
However, I’m not sure why you are getting different results here, the query seems custom as the above is the default and the options set in the template section I mentioned should affect the results (and they do locally for me).
Are you hooking into the output with a custom plugin at all?
We do have some examples of removing expired events using
But I’m confused as to why you’re getting a different output than expected here and the above may not work with it.
The support post ‘Remove expired events from archive page for espresso_event_categories’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.