Skip Navigation

[Resolved] Display posts published between 2 custom dates

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

Problem:

I need to create a view that displays posts from a custom post type (CPT) published between two selected dates. The end-user should be able to select the date range (start and end) using calendar date pickers on the front end.

Solution:

Create a custom field to store the published date of posts. Use the legacy Views interface to create the view, and manually add select boxes for the date range. Then, apply custom code to modify the query and reload the page with filtered results.

Relevant Documentation:

https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query

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.

This topic contains 1 reply, has 1 voice.

Last updated by Christopher Amirian 1 week, 5 days ago.

Assisted by: Christopher Amirian.

Author
Posts
#2792012

I need to create a view that will display the post of a CPT that were published between 2 dates.
The end-user need to select the 2 dates on a calendar (beginning-end).
How can I create the view to have 2 date pick-up on the front-end and then the list of my posts published between these 2 dates ?

#2792062

Christopher Amirian
Supporter

Languages: English (English )

Hi,

Welcome to Toolset support. It is not possible to do that with normal Toolset features.

What I have in mind is to create a custom field for the date that contains the published date of the post.

Then using the legacy views to create a view and add manual select boxes for the date range that the customer needs to select.

Then using the custom code for query to reload the page with the result:

https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query

This will take time and it is honestly outside of our support scope. I will do my best to give the initial steps to you.

I'd appreciate it if you could give me the URL/User/Pass of your WordPress dashboard after you make sure that you have a backup of your website.
It is absolutely important that you give us a guarantee that you have a backup so if something happens you will have a point of restore.

Make sure you set the next reply as private.

Also tell me which post type and view you want the search to work on. (You may need to recreate the view with legacy version if you did not already do that)

Thanks.