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 526 Bricks code tutorials with BricksLabs Pro

Related Tutorials..

Pro
Conditional Output Based on ACF Date Field in Bricks

Conditional Output Based on ACF Date Field in Bricks

Updated on 1 Aug 2024 Looking to have a Section or other elements in Bricks rendered on the frontend only if today's date is before…
Categories:
How to create parallax effects using Rellax.js in Bricks

How to create parallax effects using Rellax.js in Bricks

This tutorial provides the JS & PHP codes that can be pasted in order to create smooth parallax effects using the Rellax.js library inside Bricks…
Categories:
ACF Checkbox Items with Custom SVG Bullets in Bricks

ACF Checkbox Items with Custom SVG Bullets in Bricks

We walk through outputting list items with SVG icons based on the choice of a ACF Checkbox field.
Categories:
Tags:
Pro
ACF Flexible Content in Bricks with Each Row in its Own Section

ACF Flexible Content in Bricks with Each Row in its Own Section

In the previous ACF Flexible Content in Bricks tutorial we showed how Bricks' Flexible Content type of query can be used for showing the ACF…
Pro
ACF Font Awesome Field in Bricks

ACF Font Awesome Field in Bricks

We walk through using the Advanced Custom Fields: Font Awesome Field plugin for showing Font Awesome icons.
Categories:
Tags: