Subscribe On YouTube

Join other subscribers and enjoy other Divi video tutorials!

How To Display Images In The Divi Gallery Module With Advanced Custom Fields (ACF)

Nelson Miller Profile Orange
In this tutorial I will show you how to display images in the Divi Gallery module using the Advanced Custom Fields (ACF) plugin free version!

▶️ Please watch the video above to get all the exciting details! 👆

THEME BUILDER: It is worth reminding you that dynamic content is often meant to be used in a template created with the Divi Theme Builder. We recommend using the Theme Builder for creating dynamic galleries. If you are not familiar with the Theme Builder, please check out our Divi Theme Builder mini course.

1. Install Necessary Plugins

Install And Activate Advanced Custom Fields

To start, install and activate the Advanced Custom Fields plugin. You can find this for free in the WordPress repository, so in your site, just go to Plugins>Add New and search for it.

Install And Activate Divi Dynamic Helper

If you have not seen our exciting new Divi Dynamic Helper plugin, please go take a look! You will need this in order to create a gallery using ACF and the Divi Gallery module.

Divi Dynamic Helper Plugin by Pee Aye Creative

Once you purchase the plugin, go to your account and download the plugin zip file. Then go to your WordPress site, Plugins>Add New>Upload. Select the plugin and install and activate it.

2. Create An ACF Field Group

After the plugins are installed, you will see a new menu item on the left side called Custom Fields. Click on that to begin.

The first step to use ACF is to create a field group, which is just the name for a specific set of custom fields. Click the Add New button and name it whatever you prefer.

Set Location

Now you need to assign this Field Group to a page, post, post type, etc. There are many options to choose from here, it is a really great system, and you can add various conditions to narrow it down exactly how you want. So just think about where you need the image gallery, and choose accordingly.

set the ACF Field Group location

3. Add ACF Image Fields

Next, you need to add the custom fields. Since we are creating an image gallery, we will need to add image picker fields. Fields can be added by clicking the +Add Field button.

add new ACF field

Add A Group Field Type

But first, we need to do one more important step. Instead of just adding a lot of image fields, we first need to create a group for them.

Add a new field and write a custom Field Label. This is the admin name of the field which will be shown to users in the backend on posts/pages, so it should be something descriptive of the image gallery and easily recognizable.

set up an ACF image group field for Divi gallery module

Next, set the Field Type to Group. This is important. This serves both a practical organizational purpose, but also a technical requirement. In the next step, we will be adding individual image fields to this group.

select group field type in ACF

This is important. This serves both a practical organizational purpose, but also a technical requirement. In the next step, we will be adding individual image fields to this group.

Add Image Fields To Group

Notice the group field now contains its own Sub Fields area to add new fields.

sub fields in ACF field group

Within the Sub Fields, click on + Add Field.

Write Image 1 in the Field Label.

Set the Field Type to Image

add image fiellds to ACF sub fields image group

Repeat – Add More Image Fields To Group

Now you should repeat this step and add more image fields. Just name each one Image 1, Image 2, Image 3, etc. You can add as many Image fields as you want.

How to decide how many fields to add? First, consider the maximum number of images that would be required in any of the galleries on your site. Then add at least as many image fields to the group. Later, when a user selects the images for a gallery, it is not required to fill each image field. It is totally fine to leave fields blank. For example, if you add 20 fields, but on one page the user only selects 12 images, then only those 12 images will show in the Gallery module and the empty fields are not used.

After adding more image fields to the group, it will look something like this:

advanced custom fields group field and image files for the Divi Dynamic Helper plugin dynamic content gallery

Now you are finished setting up the custom fields. You can now go to the page or post where you assigned the Field Group location in step #2.

4. Add Images To Page/Post

Once the custom fields are all set up in Advanced Custom Fields, and the Field Group is assigned to a location, you can go to the page or post and add images using the convenient file picker. Just click the Add Image button on each field!

select photos in advanced custom fields plugin for the Divi Dynamic Helper plugin dynamic content gallery

Clicking the Add Image button opens the WordPress Media Library where you can select an image that is already uploaded or upload a new image. The GIF below shows the process of selecting images in step #4, as well as adding the module and connecting to the fields with dynamic content in step #5.

Divi Dynamic Helper Gallery GIF

NOTE: This icon only appears when the Divi Dynamic Helper plugin is active.

dynamic content icon in the Divi Gallery module with the Divi Dynamic Helper plugin

Select The Custom Field

When you click the dynamic content icon, a new window will appear with a list of all the available custom fields on the site. You can now select any image from the group, and this will automatically load all the other images into the gallery.

NOTE: If you select a custom field from the list that is empty, no images will show in the gallery. Because of this, we recommend always selecting the first image in the group as the connected custom field, since most likely the first field would always contain an image.

The screenshot below shows how it will look when selecting the field (the custom field name will depend on whatever you have set in ACF).

selecting the first image from the advanced custom field in the Divi Gallery dynamic content

The screenshot below shows how it will look after selecting the field.

selecting the first image from the advanced custom field image group for the Divi Gallery dynamic content

Save The Module Settings

You are finished with the setup! Be sure to save the module settings, and when  you exit the builder, you will see the Divi Gallery module contains the images from the custom fields and can be viewed like usual.

Everything else about the Gallery module can be adjusted according to your preference and will work just like normal.

Subscribe For More Things Like This!

At the start of each month, we send out a recap newsletter from the month before with family news, Divi news, our latest tutorials, and product news. Occasionally, if the news is too exciting to wait, we will send out another email separate from the monthly newsletter. That’s what you get when you subscribe, and of course you can unsubscribe if you are no longer interested!

Blog Post Optin

Leave A Response!

By commenting you agree to our Blog & YouTube Comments Policy

17 Comments

  1. Bob Brace <span class="comment-author-role-label"><a href="https://www.peeayecreative.com/product/divi-adventure-club/" class="comment-author-role-link" rel="external nofollow" target="_blank">Divi Adventure Club Member</a></span>

    Will this work with ACF Pro’s gallery module? With this I can add images to a custom field in the events calendar and then using your divi events module I can display a unique gallery for each event and the user can simply add images when adding an event rather than using image ID’s

    Reply
  2. Eusebio <span class="comment-author-role-label"><a href="https://www.peeayecreative.com/product/divi-adventure-club/" class="comment-author-role-link" rel="external nofollow" target="_blank">Divi Adventure Club Member</a></span>

    I love the plugin and all those that can connect to ACF. It would be great to be able to connect the “Gallery” data type that ACF Pro has. It would be really awesome.

    Reply
  3. Morten

    Hi Nelson.
    Neat solution… Will it work with the repaterfield option in ACF…?
    Best,
    Morten

    Reply
  4. Sadie Quinn

    Any plans to integrate with generic Gallery fields in 3rd party modules, e.g. Divi Supreme?

    Reply
  5. Eric Steur <span class="comment-author-role-label"><a href="https://www.peeayecreative.com/product/divi-adventure-club/" class="comment-author-role-link" rel="external nofollow" target="_blank">Divi Adventure Club Member</a></span>

    Hi there, great solution that works for my clients website. Only one thing… if no images are selected the gallery displays default 5 other images, not related to the post. Any idea how to solve this?

    Reply
      • Phil Ward

        Hi Nelson,

        We need the same feature that if no images are selected random ones are not shown. tried to apply conditional logic but that only appears to work for manual custom fields. Any idea when this will be added?

        EDIT: Ah, found the solution using conditional logic just use the ‘Manual Custom Field Name’ and set it to show if ‘acf_gallery_group_image_1’ ‘Is Any Value’

  6. Wouter

    Hello, will this work with ACF Pro’s gallery module?

    Reply
  7. Gavin Young

    HI Nelson – Great tutorial.

    I tried this, but it only loads one image instead of the 6 loaded (Divi Dynamic Helper installed). Is there perhaps something we are missing? We are building a detail layout page for a listings website.
    Thanks

    Reply
      • Gavin Young

        Thanks Nelson – I’ll log a ticket for better insight

        much appreciated

Submit a Comment

Your email address will not be published. Required fields are marked *

Recent Posts

0

Your Cart