5th Jun '24
/
2 comments

Dynamic HappyFiles Galleries using ACF Taxonomy Field in Bricks

Updated on 14 Feb 2025

This Pro tutorial provides the steps to output images from the selected HappyFiles gallery/galleries on single posts using ACF's Taxonomy-type custom field in Bricks.

Consider the following scenario.

Media Library with custom folders created using HappyFiles Pro:

CPT: service

Service Fields:

Service 1 post editor:

Service 1 front end:

Service 2 post:

Service 2 front end:

Service 3 post:

Service 3 front end:

We shall ensure that the Section is not output for posts that do not have at least one HappyFiles Folder selected.

Step 1

Create folders in your Media Library via HappyFiles.

Create a Taxonomy-type field attached to your post type.

Taxonomy: Folder

Toggle off 'Create Terms'

Return Value: Term ID

Edit your posts and tick the corresponding media folder for each.

Step 2

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
ACF Flexible Content Field – Layout Labels and Sub Field Labels

ACF Flexible Content Field – Layout Labels and Sub Field Labels

How to output the text of layout labels and/or sub field labels using the Flexible Content field of ACF Pro.
Categories:
Pro
Google Maps JavaScript API in Bricks

Google Maps JavaScript API in Bricks

This Pro tutorial provides the steps to show post-specific maps with custom marker content in Bricks using Google's Maps JavaScript API and Advanced Custom Fields.…
Categories:
Pro
Merging ACF Gallery Images with Featured Image in Bricks

Merging ACF Gallery Images with Featured Image in Bricks

Updated on 12 Mar 2025 In the Bricks Facebook group a user asks: Merging images from different fields into a single gallery Hi, I have…
Categories:
Pro
Media Library PDF Attachments Listing in Bricks

Media Library PDF Attachments Listing in Bricks

Updated on 9 Sep 2024 This Pro tutorial provides the steps for displaying PDF files from a HappyFiles folder as a list/grid using a Bricks…
How to populate a map with dynamic markers from a CPT using ACF in Bricks (PART 1)

How to populate a map with dynamic markers from a CPT using ACF in Bricks (PART 1)

This tutorial provides the PHP & JS codes that can be pasted in order to create a dynamic map with markers populated from a custom…
Categories:
Pro
Category Grid with ACF Images in Bricks

Category Grid with ACF Images in Bricks

Creating a grid of post categories, each category card showing an image from an ACF field, category name & description.
Categories:
Pro
Outputting ACF Repeater’s Sub Fields

Outputting ACF Repeater’s Sub Fields

This Pro tutorial provides the code for printing custom HTML after looping through rows of a ACF Repeater (available in ACF Pro) that has a…
Categories: