Forums › Forums › Search & Filter Pro › Displaying datepicker field
- This topic has 19 replies, 2 voices, and was last updated 8 years, 5 months ago by Trevor.
-
Trevor(Private) May 25, 2016 at 12:21 pm #46642
OK, the
get_field('resource_date')
part needs to be inside a php function. See here:http://php.net/manual/en/datetime.createfromformat.php
Look at the example#2 towards the bottom.
Modifying what they have there.
$resource_date = DateTime::createFromFormat('Ymd', get_field('resource_date')); echo '<p class="lol-resource-date">' . $resource_date->format('F j, Y') . '</p>';
That might even compress down to:
echo '<p class="lol-resource-date">' . DateTime::createFromFormat('Ymd', get_field('resource_date'))->format('F j, Y') . '</p>';
Anonymous(Private) May 25, 2016 at 5:00 pm #46676My local installation is version: 5.4.19.
My web server installation is version: 5.4.43. I just tested the new code on the staging site and got the same error. It seems my web host is hugely outdated. I will have to contact them and give them crap. But I would hate to think this is the sole reason for this error since it’s not something I can do anything about. Is there something else I can test for?
I did check that link and couldn’t spot the error. Would it help if you had the entire function that’s used to display the loop?
Anonymous(Private) May 25, 2016 at 8:49 pm #46696I managed to update the PHP version to 5.5.33 on my web server.
The function is still not working and now I am not getting any error whatsoever printed to the page nor in the Console. And nothing shows up on the page past the point in the loop where the function exists.
-
AuthorPosts