15th Jul '24
/
0 comments

Meta Box/ACF Images Staggered Grid Gallery in Bricks

This Pro tutorial provides the steps to show images from two Gallery-type of ACF or Image Advanced-type of Meta Box fields in a staggered grid layout.

We shall write a custom function that builds an array with IDs of images like this:

  • first image from the full width images
  • first two images from the half width images
  • second image from the full width images
  • third and fourth images from the half width images

and so on...

This function will then be set as the source of images for the Bricks' Image Gallery element.

After implementing the tutorial:

Step 1

Create a field group for your post type (page in this example) having:

If using ACF

two 'Gallery' fields

Set the Return Format to Image ID for both fields.

If using Meta Box

two 'Image Advanced' fields

Step 2

Edit your posts (Pages in this example) and populate the fields.

ACF:

Meta Box:

Step 3

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

If using ACF:

This is a BricksLabs Pro tutorial.

For full access login below or create your BricksLabs Pro account

Get access to all 613 Bricks code tutorials with BricksLabs Pro

Related Tutorials..

Custom Function for ACF Link Field

Custom Function for ACF Link Field

How to output the label of an ACF link field through Dynamic Data.
Categories:
Tags:
Pro
Update Post Meta From Another Custom Field’s Value on Post Publish/Update when using Meta Box

Update Post Meta From Another Custom Field’s Value on Post Publish/Update when using Meta Box

In the Meta Box Facebook group a user asks: Hi all, wondering if I can get some help. For custom field 1, I am using…
Categories:
Tags:
Pro
Random images from ACF Options Gallery in Bricks

Random images from ACF Options Gallery in Bricks

This Pro tutorial provides the steps to output images from an ACF Gallery-type custom field in a Bricks query loop randomly with each image appearing…
Categories:
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
Meta Box Related Project’s Featured Image URL on Single Reviews

Meta Box Related Project’s Featured Image URL on Single Reviews

Updated on 26 Jun 2025 In a recent website I worked on, a requirement was to get the URL of the featured image of a…
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
Related FAQs on Product pages Based on Product Category Taxonomy in Bricks

Related FAQs on Product pages Based on Product Category Taxonomy in Bricks

On product pages, we show all the FAQs associated with the current WooCommerce product's product categories.
Categories: