Skip Navigation

[Resolved] Search for a number between the values in two fields

This support ticket is created 5 years 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 5 years ago.

Assisted by: Luo Yang.

Author
Posts
#1409115

I have a Custom Post Type with two ACF fields: Year_Beginning and Year_Ending.

In my view, I would like to have a text field into which people can enter a 4 digit year and filter to show all the records for which that number is between the two ACF values.

So if you typed "1927" you would find a record where Year_Beginning is 1925 and Year_Ending is 1930.

I can't seem to add a custom filter that can do this. Can you tell me if there's a way to accomplish this?

Thanks

#1410961

Hello,

It is possible, you can add two filters on same URL parameter, for example:
Select items with field:
Year_Beginning is a number lower than or equal URL_PARAM(my-url-param)
AND
Year_Ending is a number greater than or equal URL_PARAM(my-url-param)

More help:
https://toolset.com/documentation/user-guides/filtering-views-by-custom-fields/