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

Related Tutorials..

Pro
Bricks Dynamic Condition – Check if today falls within 5 days before any holiday date

Bricks Dynamic Condition – Check if today falls within 5 days before any holiday date

Creating a custom condition that returns true or false depending on whether today falls within 5 days before any holiday dates selected on a Meta…
Categories:
Tags:
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
MB Favorite Posts in Bricks

MB Favorite Posts in Bricks

This tutorial explores using MB Favorite Posts in Bricks, including outputting the list of favorites via a query loop.
Categories:
Pro
Filtering posts by a group field’s subfield value with Meta Box when using a custom table in Bricks

Filtering posts by a group field’s subfield value with Meta Box when using a custom table in Bricks

Filtering a query loop to output only those posts with the value of a Select subfield of a Group field set to Yes when using…
Categories:
Tags: