Skip Navigation

[Resolved] Parametric search filter for date custom field

This support ticket is created 6 years, 7 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 5 replies, has 2 voices.

Last updated by Luo Yang 6 years, 7 months ago.

Assisted by: Luo Yang.

Author
Posts
#913039

I am trying to create a view with a custom search that will filter by a Toolset Types date custom field.

My view displays a list of posts. Each post has a date assigned to it with the custom field I created. When I select a date using the parametric search, I want the display to only show posts that have a particular date assigned to it, e.g. show all posts with date 28th July.

I can't get this to work. How can I achieve this?

See: hidden link

#913275

Hello,

Your custom date field is using setting "Input date and time", so it can save the time value, like this:
Tuesday 24 July, 19:00

But in the Views custom search form, the date filter can only pass the date value, for example: Tuesday 24 July
so those values aren't equal, and it won't be able to work as you expected.

I suggest you setup the filter using BETWEEN function, so when user search the date as below:
Between Tuesday 24 July and Tuesday 25 July
Then they will get the expected results.

see our document:
https://toolset.com/documentation/user-guides/date-filters/#filtering-between-dates

#914679

Hi. Thanks for the advice.

Could you please provide a bit more detail about how to set this up?

I have got as far as setting the between PAST DAY and FUTURE DAY - see screenshot:

hidden link

What goes in the other associated boxes?

Does the user have to choose the start and end days?

#915049

You need to setup two date-pickers,:
"Start date" and "End date"

For example, edit your view, find the section "Search and Pagination", if you can not see it, you can enable it by this: click "Screen option", option "View purpose" choose "Full custom display mode"

click button "New filter", add a filter on your custom date filter, see screenshot: between.JPG

More help:
Building Custom Searches for Any Content Type
https://toolset.com/documentation/user-guides/front-page-filters/

#915175

Great. Thanks.

#915542

You are welcome