26th Jul '24
/
0 comments

Featured Image’s Meta in a Bricks Posts Query Loop

This Pro tutorial provides the steps for outputting values of custom fields for the featured image of current post in a Bricks query loop.

Consider this sample field group created using ACF:

Field label: Original SourceField type: URLLocation: Attachment = All

After implementing the tutorial:

Notice the ORIGINAL SOURCE link for the featured images with the field populated. It links to the value (in this case, a URL) set for the images.

Step 1

Using your favorite custom fields plugin create a custom field for either all attachments or image-type of attachments.

Edit your posts' featured images and populate your custom field.

Step 2

Add the following in child theme's functions.php (w/o the opening PHP tag) or a code snippets plugin:

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
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:
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:
Pro
Conditional Output based on Date Time Picker Field in Bricks

Conditional Output based on Date Time Picker Field in Bricks

In the past, we showed how elements can be conditionally output based on a post's Date type of ACF field here. This Pro tutorial for…
Categories:
Pro
Programmatically populating ACF field values in WordPress

Programmatically populating ACF field values in WordPress

An example of how to set the values of a Select-type field with the names and labels of all public post types.
Categories: