18th Aug '23
/
15 comments

Meta Box Image Advanced Field Images in Bricks Query Loop

Updated on 3 Feb 2025

A user asked:

Do you know what the best way to query an image from metabox gallery?

I would like to query the top 3 images from a metabox gallery but there doesnt look like an easy way. The only way I found is to use the gallery element from bricks but customization is limited.

I would like to set a block as a query loop and add an image element on it so I can do more things with it

This Pro tutorial provides the steps to set the images uploaded/selected in a Meta Box "Image Advanced" type of custom field as the source of images of an Image element in a Bricks query loop of type Posts → Media.

Step 1

Create an Image Advanced field for your desired post type or a specific post.

In this example, we created one called page_gallery for all Pages.

If you'd like to restrict the number of images, enter a number in the "Max. number of files" field.

Step 2

Edit your Pages and populate the field.

Step 3

Edit your Page/template with Bricks.

Add a Section having this structure:

Heading is of course optional.

Enable query loop on the Block.

Click on the query icon and select Media in the Post type control.

Select the Image element and set its data source to

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
Dynamic Accordion in WordPress using Meta Box and Alpine.js

Dynamic Accordion in WordPress using Meta Box and Alpine.js

This Pro tutorial provides the steps to implement an accordion using Alpine.js in WordPress that pulls the values of sub fields of a Meta Box…
Pro
Bricks Dynamic Data Tag for Text-type Custom Field Value with Word Limit

Bricks Dynamic Data Tag for Text-type Custom Field Value with Word Limit

How to register a new dynamic tag for setting excerpt word limits and outputting an ellipsis (...) at the end.
Categories:
Pro
Querying Posts by Date/Datetime Custom Fields in Bricks

Querying Posts by Date/Datetime Custom Fields in Bricks

This Pro tutorial shows how to configure ACF and Meta Box to query posts in Bricks by custom field(s) of the type Date/Date Time Picker…
Categories:
Tags:
Pro
Filtering Bricks Query Loop By Meta Box Relationship

Filtering Bricks Query Loop By Meta Box Relationship

In the Bricks Facebook group a user asks: Consider this setup: CPTs: Service Areas and City Pages Meta Box Relationship: City Pages to Service Areas…
Categories:
Pro
Adding FAQ page Schema with SlimSeo Schema & Meta Box

Adding FAQ page Schema with SlimSeo Schema & Meta Box

SlimSeo Schema is a plugin by the people behind both SlimSEO & Meta Box. It takes care of adding all the page schema across your…
Categories:
Meta Box Category Colors in Single Posts

Meta Box Category Colors in Single Posts

Looking to use Meta Box Color Picker fields' values in a single post Bricks template based on the post category? This tutorial shows how. Note:…
Categories:
Tags:
Pro
Meta Box Color Picker to CSS Custom Property Workflow in Bricks

Meta Box Color Picker to CSS Custom Property Workflow in Bricks

This Pro tutorial provides the steps to declare a custom property (CSS variable) whose value is equal to the post-specific color set via a custom…
Categories:
Tags:
Pro
Dynamic Post-specific Templates in Bricks using Meta Box/ACF Select Field

Dynamic Post-specific Templates in Bricks using Meta Box/ACF Select Field

Update on 23 Aug 2023: Added steps for ACF. Bricks builder v1.8.4 introduced an pretty useful filter called bricks/active_templates that flew under the radar. This…