Skip Navigation

[Resolved] Display a date-based event widget

This thread is resolved. Here is a description of the problem and solution.

Problem: I have a View that displays posts. The posts have a custom date field, and I would like to only display posts with a custom date field value of today or later.

Solution: Use the Query Filter panel to add a custom field filter based on the date field, as an UNSIGNED, with a value greater than or equal to TODAY.

Relevant Documentation:
https://toolset.com/documentation/user-guides/date-filters/

This support ticket is created 4 years, 11 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 2 replies, has 2 voices.

Last updated by russellH-3 4 years, 11 months ago.

Assisted by: Christian Cox.

Author
Posts
#1239934

I am trying to:
Use Views to display posts in a widget. These posts are categorised as 'Events' and use Toolset Custom Fields to include a start and end date. I want the widget to display any events happening today or any date after today, but not expired events.

When setting up the View, I have tried to filter what's seen in two ways:
1. That the post has the taxonomy category of Events
2. That the Custom Field 'Start Date' is a DATETIME (I have also tried DATE) that is either greater than or equal to NOW.

When configured that way, no posts show up in my widget at all. So I have had to remove the second filter so that at least the Events appear in the widget, though it displays an expired event which I don't want. Configuration screenshots:
hidden link

Link to a page where the issue can be seen:
hidden link (look in the rightmost column under the 'Events' header)

I expected to see:
Events from today or after displayed.

Instead, I got:
Either no events at all, or all events.

#1239952

2. That the Custom Field 'Start Date' is a DATETIME (I have also tried DATE) that is either greater than or equal to NOW.
Hi, when comparing custom date fields you should choose "UNSIGNED" for best results. Also if the start date is greater than or equal to NOW, some results may not appear in the list if their start date included a time that is earlier than now. Those events would technically be happening today, but not appearing in the results. For that reason, TODAY might be a better option than NOW.

#1239966

Hey Christian:

OK, that's great, thanks. Your suggestion fixed it. Many thanks for the quick response!

Kind regards, Russell

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.