Posted: April 10, 2018 at 3:47 pm
I have a custom events widget set up and would like to only show the event for the current week (next 7 days) and not show other datetimes for the event. Is this possible Thanks |
|
Hi Creative Manitoba, If your custom widget is a copy of the built in Event Espresso Upcoming Events widget, then the following code can be added to a plugin:
The above filter function callback will change the query to limit the events that have datetimes during the next seven days. |
|
Thanks Josh, Either it didn’t work or I wasn’t clear enough (my apologies). It is still displaying all the datetimes for the events and I only want the datetime for this week to display. We have courses that run for several weeks and so we’ve created multiple datetimes for each class in a course. I added the snippet to my functions plugin. I downloaded the custom widget from a link in a previous forum post on customizing the widget, but I can’t find the link now. It looks like a copy of the original widget. Here’s the opening few lines of my custom widget:
Any help appreciated. Thanks. |
|
I’m sorry, I forget to mention that you can control the number of datetimes displayed by going to the widget settings. There you can set the number of datetimes to 1. |
|
Great. That worked. I had an error in a custom espresso_list_of_event_dates function that was causing more than one date to show, but all fixed now. Thanks for all your help. |
|
The support post ‘Custom Event Widget Only show current week's events’ 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.