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

Related Tutorials..

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:
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…
Color Custom Field as Section Background Color on Category/Term Archives in Bricks

Color Custom Field as Section Background Color on Category/Term Archives in Bricks

How to use a color from a taxonomy term custom field for as the hero section background color on archive pages.
Categories:
Tags:
Random Meta Box Image

Random Meta Box Image

Displaying a random image from a set of images from a Meta Box Images Advanced-type field.
Categories:
Tags:
Pro
Nested Meta Box Query Loop Inside a CPT Query Loop in Bricks

Nested Meta Box Query Loop Inside a CPT Query Loop in Bricks

This Pro tutorial provides the steps for setting up a cloneable Meta Box group query inside a CPT query in Bricks. Scenario: CPT: course Meta…
Categories:
Pro
Meta Box Checkbox List Query Type in Bricks

Meta Box Checkbox List Query Type in Bricks

This Pro tutorial provides the steps to add a new query type in Bricks builder for displaying the values of a Checkbox List type of…
Categories: