Parsing ACF date in Cornerstone

Hi,

I am building an event calendar based on a custom post type. I’ve set the event date with a custom date field in ACF pro, and I want to output the calendar differently through out the website with the wonderful loopers. In the design I would like to be able to treat different elements of the date separately, and I was wondering if there is any way I can get cornerstone to read this ACF field as a date, and then output it however I want in the editor? If not, any advice on alternatives?

All the best,
Andreas Rokseth

Hey Andreas,

The way to display an ACF field is to use a ACF Dynamic Content. If you’re not familiar with the usage yet, I’d recommend you check out our tutorials in our Youtube channel Loopers playlist here.

The following code is an example to output the raw ACF date field.

{{dc:acf:post_field field="date"}}

image

To format it the way you want, you just add type="date" then format="Y/m/d" inside the Dynamic Content. You can change the format according to PHP date format. Check out the list of possible formats here: https://www.w3schools.com/php/func_date_date_format.asp

image

Hope that helps.

Fantastic, that did the trick! Thanks a lot!

Hey Andreas,

You’re welcome! If you have any other concerns or clarifications regarding our theme features, feel free to open up a new thread.

Thank you.

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