Forums › Forums › Search & Filter Pro › if post meta datestamp is in future
- This topic has 9 replies, 2 voices, and was last updated 5 years, 9 months ago by Trevor.
-
Anonymous(Private) January 28, 2019 at 2:06 pm #200140
Hi there,
For a website I created a filter with events. The events need to be in the future. So I want to check if the from date is after today. If so show results. If not check if the end date is after today, if not don’t show the event, if so show results.
The from and end date are specified in the post meta of the posts. How can I configure this in the post meta tab?
Trevor(Private) January 28, 2019 at 3:17 pm #200159It is not possible to do this in that tab. You would need to create some custom code to do this using this filter:
https://searchandfilter.com/documentation/action-filter-reference/#edit-query-arguments
Anonymous(Private) February 6, 2019 at 1:23 pm #201409Hello Trevor,
I hope you can help me with the following:
How can i prefill a datepicker field in the filter? I want to prefill it with the current date. Can i use the mentioned filter for that because we’ve tried multiple things but we can’t get it to work.Thanks in advance.
Trevor(Private) February 6, 2019 at 1:58 pm #201434Ah, then that is a problem that cannot be resolved. Using the filter will allow you to set the value, but it will not affect the initial page load. Using JavaScript to do the same will then overwrite any selection made subsequently by the user. I am sorry, but what you want is not currently possible.
Anonymous(Private) February 6, 2019 at 3:33 pm #201473Ok, so if I understand well the plugin does allow to render results on page load, but doesn’t allow to filter those results.
What about the following:
Is the sf_input_object_pre filter hook not called on page load? If it is, I could check if the ‘from data’ field is empty and if so I’d add the present date to the $input_object.Could this work?
Thank you in advance
-
AuthorPosts