Posted: December 10, 2020 at 5:20 am
Hi, We want to hide sold out events from the events list to encourage people to book those which are available or request a custom event. I found this: But we are not using the Event Table addon, as we have Multi-Event Registration so I can’t find the particular template mentioned, nor a similar one. Kind regards, Anita |
|
Hi Anita, You can use a snippet like this: https://gist.github.com/Pebblo/285340c950796e16eae8ba1d2e520513 That should remove sold out events from the front end event lists. |
|
Thanks Tony. I added that to site-specific plugin; so added the add_filter to the class constructor, and the function as given later in the class (copied and pasted). But broke the site. Pretty much any page gives a 404 error with the new filter enabled. The pages return when I comment it out. Site is using WP 5.4.2 |
|
Can you post the code you are using, please? Add it to a Gist or Pastebin and post the link here. The above snippet is working fine for me. |
|
I think it’s here: https://pastebin.com/e9vFUZQX |
|
When you’re working within a class, you need to declare where the function comes from in your So on line 86, this:
Needs to be:
Does it work then? |
|
Aggh, stupid mistake. Sorry. Yes it worked once I’d moved the closing bracket. Also tweaked to remove events that are password-protected:
Pasted in case useful to others. |
|
Lol, oops, nice spot. My mistake this time and I’ve fixed it in my post in case anyone copies it. Thanks for sharing your updated code and I’m glad it’s now working for you. |
|
The support post ‘How do we hide events that have sold out?’ 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.