Skip Navigation

[Resolved] How can I make a Custom Date Filters?

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

Problem:
How can I make a Custom Date Filters greater than today?

Solution:
Custom field created using Types plugin and you want to filter your event posts for future events. i.e. "Only the events dates higher than today" (YYYYMMDD > YYYYMMDD).

You can find the proposed solution, in this case, with the following reply:
https://toolset.com/forums/topic/how-can-i-make-a-custom-date-filters/#post-1301203

Relevant Documentation:
=> https://toolset.com/documentation/user-guides/filtering-views-by-custom-fields/

This support ticket is created 5 years, 6 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 2 replies, has 2 voices.

Last updated by alixB 5 years, 6 months ago.

Assisted by: Minesh.

Author
Posts
#1301137

I'm trying to display futures events in a view. I have events (post) with a meta key event_date stored with this format YYYYMMDD.

And I would like to display only the futures events, so the logic would be "Only the events dates higher than today" (YYYYMMDD > YYYYMMDD)

But, in Date Filters is only using timestamp (https://toolset.com/documentation/user-guides/date-filters/). So that's not possible with my data stored.

Can I add a new custom date filter to add this format YYYYMMDD? How?

Thank you!

#1301203

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

As I understand you have a date (event_date ) custom field created using Types plugin and you want to filter your event posts for future events. i.e. "Only the events dates higher than today" (YYYYMMDD > YYYYMMDD).

Types date custom field stores its value as Unix timestamp to the database. So to filter the events greater than today. What if you try to add the custom field query filter from "Query Filter" section of your view:
=> https://toolset.com/documentation/user-guides/filtering-views-by-custom-fields/

Please check the following screenshot:
=> https://toolset.com/wp-content/uploads/2012/07/Filtering-Views-Query-by-Custom-Fields2.png
- So you should try to add query filter - where you should add TODAY() in constant box:

Select items with field:
event_date  is a number greater than TODAY()
#1301415

I'm not using the Types plugin problem, so my field is not stored as a timestamp but I will use Types for this part.
Thank you!