Support

Search results for ""

Sorry, no results found. Perhaps you would like to search the documentation?
All Topics
Sergio Belgrano

Filter date range

Hi!
I have a CPT with 2 ACF fields used to setup a date range validity for each posts.
The first ACF defines the from date, the second one defines the to date.

Now I need to create a date range filter in the backand, with the aim to filter these posts to search all the posts planned in a certain period (for example “all the post that will be visible in the month of february”).

Take this example:

Post “test 1” ACF_from 01/01/2023 ACF_to 31/01/2023
Post “test 2” ACF_from 01/01/2023 ACF_to 31/03/2023
Post “test 3” ACF_from 01/02/2023 ACF_to 28/02/2023
Post “test 4” ACF_from 09/02/2023 ACF_to 30/04/2023

Now I’m going to make this kind of filter:
“Filter all the posts visible inside this range: from 01/02/2023 to 28/02/2023”

What I need as search result is:

Post “test 2” ACF_from 01/01/2023 ACF_to 31/03/2023
Post “test 3” ACF_from 01/02/2023 ACF_to 28/02/2023
Post “test 4” ACF_from 09/02/2023 ACF_to 30/04/2023

Also “test 2” and “test 4”, because has ACF_to date bigger than the to date searched, so I know that these post will be visible in the date range I search.

Thanks!

1 year, 2 months ago
Stefan van den Dungen Gronovius
Developer

Thanks for your detailed explanation.
In order to search all items that are visible inside a range, you’ll need a more complex filter with an ‘Or’ operator. Unfortunately, our plugin does not have a way to filter the way you like since all the filters work together as an ‘AND’ filter. I don’t see a workaround to make this work with our plugin.

1 year, 2 months ago

You must be logged in to reply to this topic.