19th Jul '24
/
0 comments

Post-specific HappyFiles Galleries using a ACF Select Field in Bricks

Post-specific HappyFiles Galleries using a ACF Select Field in Bricks

This Pro tutorial provides the steps to use ACF to select one or more HappyFiles' folders and output the images from the selected folder(s) using HappyFiles shortcode or Bricks' Image Gallery element or img elements in a query loop.

This is the equivalent of Post-specific HappyFiles Galleries using a Meta Box Select Field in Bricks tutorial but for ACF instead of Meta Box.

Step 1

Install and activate HappyFiles.

Go to Media → Library.

Create folders and categorize images by moving them into the folders.

Step 2

Install and activate ACF.

Go to ACF → Field Groups.

Create a new field group for your post type having a Select-type field.

Leave the Choices empty. We shall populate it programmatically in the next step.

If you would like to be able to select multiple folders, enable the "Select Multiple" option.

If you would like - Select - to appear as the 1st option for this field in the post editor screens, enable Allow Null in the Validation tab.

Step 3

Let's define a custom function to populate all HappyFiles folder names as options of above Select field.

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

Related Tutorials..

ACF Repeater Sub Field Values as Tabs in Bricks

ACF Repeater Sub Field Values as Tabs in Bricks

Bricks' query loop supports ACF Repeaters and Meta Box Groups out of the box besides posts, users and terms. This tutorial shows how we can…
Categories:
Tags:
How to create filters with IsotopeJS in Bricks (Part 3): apply multiple filters

How to create filters with IsotopeJS in Bricks (Part 3): apply multiple filters

This tutorial will review how to apply multiple filters to an isotope container using the IsotopeJS library‘s features in Bricks.
Pro
Conditional Rendering of ACF Repeater Rows Based on True / False Sub Field in Bricks

Conditional Rendering of ACF Repeater Rows Based on True / False Sub Field in Bricks

This Pro tutorial provides the steps to modify a ACF Repeater query loop to only output the rows for which a True / False type…
Categories:
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
Customizing ACF Repeater/Relationship or Meta Box Relationship Query Parameters in Bricks

Customizing ACF Repeater/Relationship or Meta Box Relationship Query Parameters in Bricks

For query types other than post, term and user in Bricks i.e, ACF Repeater/ACF Relationship/Meta Box Relationship there are no built-in controls for modifying the…
Categories:
Pro
Bricks Dynamic Data Tag for Text-type Custom Field Value with Word Limit

Bricks Dynamic Data Tag for Text-type Custom Field Value with Word Limit

How to register a new dynamic tag for setting excerpt word limits and outputting an ellipsis (...) at the end.
Categories:
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: