Skip Navigation

[Resolved] I want to filter posts by date range.

This support ticket is created 2 years, 2 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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Hong_Kong (GMT+08:00)

This topic contains 1 reply, has 2 voices.

Last updated by Luo Yang 2 years, 2 months ago.

Assisted by: Luo Yang.

Author
Posts
#2465563
#2465739

Hello,

There isn't such kind of built-in feature within Toolset plugins.

You might consider custom codes, for example:
1) In the custom search form, add two date-picker field:
- Start Date
- End Date
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-control-postmeta

After user choose values in above date-picker fields and submit the search form, it will pass URL parameters to the view.

2) Use filter hook wpv_filter_query to add a post date into the view's query, use those URL parameters to filter the results:
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-control-postmeta
https://developer.wordpress.org/reference/classes/wp_query/#date-parameters