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

Related Tutorials..

Pro
Testimonials Slider in Bricks

Testimonials Slider in Bricks

Setting up a dynamic testimonial slide that pulls the data from a CPT's post fields and custom fields.
Categories:
Tags:
Pro
ACF Options Fields in Bricks

ACF Options Fields in Bricks

This Pro tutorial walks you through outputting the values of custom fields attached to an ACF Pro's Options page in Bricks builder. We shall register…
Categories:
Pro
ACF Taxonomy Field Value in Single Posts

ACF Taxonomy Field Value in Single Posts

Consider this scenario: CPT: Movie Movie CPT Taxonomy: Movie Genre Movie Genre Taxonomy's field: Genre Color Each movie will have only genre set. The requirement…
Categories:
Tags:
Pro
Filtering posts by a group field’s true / false field sub field value with ACF or Meta Box in Bricks

Filtering posts by a group field’s true / false field sub field value with ACF or Meta Box in Bricks

This Pro tutorial covers how posts of a Bricks query loop can be filtered to show only the ones whose true / false or checkbox…
Categories:
Tags:
Pro
ACF Post Object Query Loop inside a Posts Query Loop in Bricks

ACF Post Object Query Loop inside a Posts Query Loop in Bricks

How to loop through a CPT and within each post, output a list of related posts.
Categories:
Pro
Filtering Query Loop Posts by a Non-empty Custom Field in Bricks

Filtering Query Loop Posts by a Non-empty Custom Field in Bricks

This Pro tutorial shows how we can prefilter the results of a query output by a Bricks query loop to only those for which the…
Categories:
Tags:
Pro
Featured Image’s Meta in a Bricks Posts Query Loop

Featured Image’s Meta in a Bricks Posts Query Loop

How to output values of custom fields for the featured image of current post in a query loop
Categories:
Tags: