Dynamic HappyFiles Galleries using ACF Taxonomy Field in Bricks

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

Instant access to 390+ Bricks code tutorials with BricksLabs Pro