10th Dec '22
/
2 comments

ACF Date Field Value Custom Format in Bricks

In the Bricks forum, a user asks:

Hi there, I am setting up an events calendar using bricks.

In some circumstances I would like to display the date of the event as just ‘21 Dec’ and in other places with the year too and maybe written day i.e. ‘Friday 21 Dec 2022’ .

I have created a custom field with acf for the date and it works great in my repeater on the front end, but how can I change the output of the date on a case by case basis?

Simplified I’d like to do something like {acf_date:d j}

This Pro tutorial shows how we can define a custom function and use that with the Dynamic data feature of Bricks to output any Advanced Custom Fields' Date-type of field in the specified format.

Step 1

Edit the Date Picker-type of field in your field group.

This is a BricksLabs Pro tutorial.

For full access login below or create your BricksLabs Pro account

Get access to all 610 Bricks code tutorials with BricksLabs Pro

Related Tutorials..

Pro
CPT Submenu Items in ACF Pro Options Admin Menu

CPT Submenu Items in ACF Pro Options Admin Menu

This Pro tutorial provides the steps to add links to admin pages under an Options page created with ACF Pro. All code mentioned in this…
Pro
Sorting ACF Relationship Posts by Date Meta in Bricks

Sorting ACF Relationship Posts by Date Meta in Bricks

Consider the following setup: CPT: Events ACF Fields:Event Date Information (Group)|__Event Date (Date Picker)Pick Sub Events (Relationship) An Event can have 1 or more related…
Pro
Filtering ACF Repeater Bricks Query Loop by Sub Field Value

Filtering ACF Repeater Bricks Query Loop by Sub Field Value

We look into how ACF Repeater rows output by a Bricks query loop can be filtered using the bricks/query/run PHP filter.
Categories:
Pro
ACF Image Data in Bricks

ACF Image Data in Bricks

Displaying Alt text, Caption, Title and URL of an ACF image field for posts in a query loop.
Categories:
Tags:
Pro
Meta Box Date Field Value Custom Format in Bricks

Meta Box Date Field Value Custom Format in Bricks

Updated on 3 Apr 2024 Note: A custom function is no longer needed. Use the date format filter, as mentioned in the Bricks documentation. Ex.:…
Categories:
Tags:
Pro
ACF Term Meta on Single Posts in Bricks

ACF Term Meta on Single Posts in Bricks

Consider this scenario: CPT: Project Custom taxonomy: Project Type Each project will be assigned only one project type. Project Type taxonomy's custom field: Project Type…
Categories:
ACF Relationship: Count of Related Posts

ACF Relationship: Count of Related Posts

Looking to get the number of CPT B posts related to a CPT A post when using a Relationship field with ACF? Here's a custom…
Categories:
Tags: