7th Jun '24
/
0 comments

ACF Image Data in Bricks

In the Bricks Facebook group a user asks:

REPOST - can anyone please tell me how to display media file attachment data beneath the thumbnail image on an archive post page like in the the image. (I asked about displaying the alt in my OP and people jumped down my throat. The alt was just an example so I could figure out the actual method.)

I have 1500+ images created by photographers who filled in the alt, titles, descriptions and captions in lightroom. The captions are very long so if I enable captions in Bricks, the text covers the entire thumbnail (2nd image).

The archive page is an ACF cpt with one image field. I know I can add a field for the captions and output this beneath the thumbnails but that means a lot of work copying and pasting the captions. If I can display the captions dynamically from the attachment data, that will save me time.

This Pro tutorial walks you through the steps for outputting data like Alt text, Caption, Title and URL of an Image-type ACF custom field for posts in a Bricks query loop.

CPT: Service

Service Fields:

Service 1:

Service 2

Both the images have captions filled in the Media Library.

After implementing the tutorial, output on the Services CPT archive page:

Step 1

Create your CPT at ACF → Post Types.

Toggle 'Advanced Configuration'.

Under 'URLs' tab, enable 'Archive' and optionally enter an Archive Slug.

Step 2

Create the corresponding field group having an Image-type custom field.

Leave 'Image Array' as Return Format.

Create your CPT posts and populate the image field for each.

Step 3

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
ACF Relationship Select Filter in Bricks

ACF Relationship Select Filter in Bricks

In the BricksLabs Facebook group, a user asks: I'm learning about ACF relationships and attempting to output a list of posts on any given page,…
Categories:
Pro
Events grouped by Event Date custom field in Bricks

Events grouped by Event Date custom field in Bricks

This Pro tutorial for Bricks users provides the steps to output posts of an event custom post type dynamically grouped by the value of their…
Categories:
Pro
Configuring Image Gallery dynamic source in Bricks

Configuring Image Gallery dynamic source in Bricks

Let's say you have a custom field created with ACF Pro of the type Gallery called "Property Gallery" for posts of "Property" CPT. In the…
Pro
How to Update Custom Fields with Default Values For Existing Posts when using ACF

How to Update Custom Fields with Default Values For Existing Posts when using ACF

Let's take a scenario where there are 10 Pages in a WordPress site. You proceed to create a Text-type of custom field called, say, "Custom…
Categories:
Tags:
Pro
ACF User Field Bricks PHP Query

ACF User Field Bricks PHP Query

In the Bricks Facebook group a user asks: my end goal was to create a set of cards that would display the Users that are…
Categories:
Pro
Upcoming Events Grouped by ‘Month Year’ in Bricks

Upcoming Events Grouped by ‘Month Year’ in Bricks

A custom query loop type for showing future events based on a date custom field using three nested query loops.