15th Nov '25
/
0 comments

HappyFiles Folder Images via Meta Box Taxonomy Field in Bricks Image Gallery

In the Bricks Facebook group, a user asks:

Hey everyone.

I hope you are doing well.

I’m building a single-page template for a custom post type that represents different performance artists. Each artist has their own HappyFiles folder for images, and I’m using a MetaBox Taxonomy Advanced field to select the folder on each post. I have made the HappyFiles category taxonomy public so I can query it in Bricks.

The challenge is that the Bricks gallery element cannot run a query, and when I try to loop a container of Media attachments filtered by the selected HappyFiles folder, the query returns zero images even though the attachments are correctly assigned to that folder.

I may be missing something in the loop setup or the correct method of outputting attachments dynamically. Has anyone managed to query HappyFiles folders dynamically in a Bricks template and display the images without needing separate galleries?

I’m looking for the proper setup to loop attachments by the HappyFiles taxonomy and display them as a gallery for each artist.

Thank you!

This Pro tutorial provides the steps to set the source of Bricks' Image Gallery element on a single post to images present in the selected HappyFiles Folder(s) via a Meta Box Taxonomy or Taxonomy Advanced custom field.

CPT: artist

HappyFiles folders with one folder for each artist:

MB custom field for artist posts:

Objective: When viewing the single artist page, show the images from the selected HF folders in the Image Gallery.

We shall also ensure that our solution works when multiple HappyFiles folders are selected.

Step 1

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
Configuring Image Gallery dynamic source in Bricks

Configuring Image Gallery dynamic source in Bricks

Let's say you have a custom field created with ACF Pro of the type Gallery called "Property Gallery" for posts of "Property" CPT. In the…
Pro
Custom Meta Box Thumbnail Slider in WordPress

Custom Meta Box Thumbnail Slider in WordPress

This Pro tutorial provides the steps to set up an image and YouTube video thumbnail slider in WordPress using Splide and Meta Box. The site…
Categories:
Tags:
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:
HappyFiles Bricks Query Loop

HappyFiles Bricks Query Loop

This tutorial explores different ways in which images from WordPress Media Library organized via HappyFiles can be pulled and shown in Bricks using query loop(s).…
Categories:
Pro
Meta Box Taxonomy Field’s Image Value in Posts

Meta Box Taxonomy Field’s Image Value in Posts

In a project I am currently working on, the requirement is to show the image of an "Image Advanced" type attached to a taxonomy in…
Categories:
Tags:
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:
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: