Support

Home Forums Event Espresso Premium Hiding upcoming events in widget if expired or no longer bookable

Hiding upcoming events in widget if expired or no longer bookable

Posted: August 22, 2018 at 8:57 am


Omnishambles

August 22, 2018 at 8:57 am

Hi

We use an upcoming events widget in our site http://www.bbomathshub.org.uk and we display a range of events including some that have multiple date times – but where you must register before the first one in order to attend as it’s a course and you need to attend all dates. By default these will be displayed by our upcoming events widget even after the first date has passed giving our site visitors the impression that they can book a place and then they find they can’t and some are getting confused and frustrated by this. I did see a thread https://eventespresso.com/topic/upcoming-events-widget-4/ in which Josh suggests the creation of a Custom upcoming events widget and then editing the, ‘where clause’ to $where[‘Datetime.Ticket.TKT_end_date’]. I have tried this and have created the widget which now sits in the Upcoming events directory. However, I’m not clear if I should now be seeing this alternative widget in the backend of the site in Appearance>widgets ‘unused widgets’ or whether it will automatically over ride the default upcoming events widget. Please could you advise? Thanks, Jamie


Josh

  • Support Staff

August 22, 2018 at 12:13 pm

Hi Jamie,

There would actually be a second widget to configure, but the solution from the other topic is no longer necessary because there’s a filter hook now. If you use the filter hook you will not need to register an additional widget.

Instead, you can add this code to your functions file:

https://gist.github.com/joshfeck/a4bf882c0feb79459d15b2f9294b84f4

The support post ‘Hiding upcoming events in widget if expired or no longer bookable’ 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.

Event Espresso