Reply To: Search by date range with custom fields datepicker not working

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Search by date range with custom fields datepicker not working Reply To: Search by date range with custom fields datepicker not working

#15656

Ernest Marcinko
Keymaster

Hi Quim,

It could be actually doable with a custom code, I believe.
Basically you want a 'between' filter, that checks if the date is inbetween the start and the end date. I have made a custom code that may do the trick:

1. The code will try to detect the start date filter, and use it as the date to compare. For this, make sure to first delete the end date filter: https://i.imgur.com/Xm6LNaL.png
The start date filter will be used for the inbetween comparision, and the custom code will create the other 'hidden' filter to make an inbetween check.

2. Add this custom code to the functions.php in your theme/child theme directory (copy from line 3 only!). Before editing, please make sure to have a full site back-up just in case!

3. Make sure that the $field1 and the $field2 variable in the code is correctly set to the start date and the end date custom field.

..that's it!

Best,
Ernest Marcinko

If you like my products, don't forget to rate them on codecanyon :)