Posted: May 13, 2017 at 1:41 pm
|
Can you suggest a function or filter or something that I can use to display expired events on Event Category pages (e.g. /event-category/winter-2017/ but NOT on the main Events archive page (/events/). Thanks so much! |
Hi Brenda, You might try using an Event Espresso shortcode on a page instead. Here’s the shortcode I would use on a page:
Hope that helps. Please let us know if you have further questions. |
|
|
Hmm, thanks for the suggestion, but I don’t think that’s optimal for my situation. I’m setting this up for an end user to take over, and this would mean an extra complication of making a page for every new category on this dynamic website. I really hardly even need the /events/ page, except that EE4 presents a link to that archive in certain situations:
Is there some way I can change that select at least one event link? Thanks! |
The text output used there is passed through a filter so you can change it if needed, the filter is:
So something like this: https://gist.github.com/Pebblo/4aa2463d2781170f383710ce519ca082 Then just edit the link used within the function, it currently uses |
|
Hi Brenda, Here’s an example that shows how to use the pre_get_posts hook to remove the filters that filter out the expired events on the event category archives: https://gist.github.com/joshfeck/868ba9f309019d1b9d8b2187d56ad7bb You can add the above to a functions plugin or into your WordPress theme’s functions.php file. |
|
|
Ooh, both excellent suggestions! Josh, I set Display Expired Events to NO globally, then used your code to negate that for Category pages. Works nicely! On on /events/, I’d also like to hide events where tickets are have ended — is there a way to filter out those? |
You can use this to filter those out: You can remove this part:
and add a conditional for |
|
|
Thanks, Josh, I will give that a shot! |
The support post ‘Display expired events on Event Category pages but not on main Events archive’ 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.