Forums › Forums › Search & Filter Pro › ACF change date field output
Tagged: V3
- This topic has 8 replies, 2 voices, and was last updated 6 years ago by Trevor.
-
Anonymous(Private) November 7, 2018 at 3:30 pm #193038
Hi Trevor,
I have set the display format to : d/m/Y and the output to custom j F Y. I have already tried to change these settings but it’s still not working.
It is happening in the filter. I use a dropdown and the options are in Ymd 20181224 and 20181225.
Any idea?
Thanks
BrittTrevor(Private) November 8, 2018 at 1:11 pm #193156Ah, I see now. You are not using the date/datepicker option, instead the choice option. You will need to make a bit of Custom coding to change the shown date using our Filter Input Object filter and process the ACF date into a Date format that you want.
This should be an option I think, for the future. Is it OK for me to raise this as a feature request?
Anonymous(Private) November 8, 2018 at 1:28 pm #193165Hi Trevor,
This is the code we’ve used btw. Maybe it’s useful 🙂
function filter_function_name($input_object, $sfid) { if($input_object['name']=='_sfm_kalender_datum') { foreach($input_object['options'] as $option) { if($option->value != "") { $date = strtotime( $option->label ); $option->label = date('d m Y', $date); } } } return $input_object; } add_filter('sf_input_object_pre', 'filter_function_name', 10, 2);
-
AuthorPosts