ACF Time Picker

Hi team,

I ham using a datepicker and if the date is left empty in the back end. the front end shows the time of the entry was made.

I have had two others web guys check on their servers and setup to rule out server issues and they have same thing. One said

"I tried it on a local setup and when I leave the field blank I get the current time of the laptop (depending on timezone settings in WP) output onto my page. "

So if left blank it seems to just show time of day. Is there a way to force it to show nothing or an else of if nothing thens ay “Closed” as I am using the timepicker to show opening hours.

I have attached screenshot of back end showing blank field and front end showing the time that I created the entry.

Thanks a lot

Hey Mark,

Thanks for reaching out!

Would you mind sharing your admin credential so that we can check your setup? To do that, please give us the following information in a Secure Note.

  • WordPress Login URL
  • Admin level username and password

You can find the Secure Note button at the bottom of your posts.

Thank you.

Done, and saved

Hi Mark,

I see you added some invalid tags and quotations on your dynamic code

<h4 style="text-align: right;">{{dc:post:meta key="friday_opening_hours" <span>type="time" "format=“hh:mm a"</span>}} - {{dc:post:meta key="friday_closing_hours" <span>type="time" "format=“hh:mm a"</span>}}</h4>

Please keep it clean

e.g. {{dc:acf:post_field field="sunday_closing_hours" fallback="closed"}}

The fallback attribute is what you’re looking for, it will substitute if the value is empty.

Hope it helps,

Ah perfect thank you, I was trying allsorts as I couldn’t get it to work.

Didn’t know it was dc:acf:post_field and not cd:post:meta key

All working now, thanks

Hi Mark,

Glad that we are able to help you.


This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.