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