Tell us what you are trying to do?
I am trying to create an archive page where the user can choose to display all the posts that were published between two different dates
Is there any documentation that you are following?
I couldn't find any documentation regarding this topic
Is there a similar example that we can see?
Hello. Thank you for contacting the Toolset support.
As I understand, you want to add a frontend filter to your archive view where you can offer two date filters (one for start date and one for end date) to users to filter the posts by default post date. If this is correct - there is no such feature available to add frontend filters for default post date.
As a workaround, you should try to add a custom date field that should hold the publish date and then add the custom date field as a frontend filter to filter your posts between start - end date.
Yes indeed that is excactly what I would like to achieve. The question however is, even with the workaround you propose:
1) Am I suppose to fill up the custom date field by hand every time I create a post, or is there a way for it to be automatically filled with the actuual publication date (since this already exist in WP database)?
and..
2) Even if I create this custom date field, could you please elaborate more on how to create a custom search field so that the user can access two "calendars" and change period during which he ewants to filter the posts? (the problem is that once I add a search filed based on the custom date-filed, then I cant use it again and on top of that I haven't found any way to add logic between two search-fields).
As an example, imagine that the final result at the front end should be two date calendar-like filters with which the user can set the day-after and day-before period based on wich the search for the posts will be conducted.
1) Am I suppose to fill up the custom date field by hand every time I create a post, or is there a way for it to be automatically filled with the actuual publication date (since this already exist in WP database)?
and..
===>
You will require to use the save_post action hook and add the code that should get the current publish date and copy it to the custom date field you created using Types.
Please note that you will have to convert the date string to Unix Timestamp as Types custom date field stores the value as Unix Timestamp.
2) Even if I create this custom date field, could you please elaborate more on how to create a custom search field so that the user can access two "calendars" and change period during which he ewants to filter the posts? (the problem is that once I add a search filed based on the custom date-filed, then I cant use it again and on top of that I haven't found any way to add logic between two search-fields).
===>
You should add the custom date field as filter and then you should select the between, please check the following screenshot, it will give you two date picker (start and end).
- hidden link