Limited Time Sale - 10% Discount! Use Code:U5ZBQTEY

Custom Lightbox

This document explains how to use the Custom Lightbox Gallery option available in the Thumbnail Action section of the Content tab in the Divi FilterGrid plugin.

Turning on the Custom Lightbox Gallery option will reveal the Custom Field Name for Images field in the module’s settings. Here you can enter the name of the custom field that contains a single image URL or an array of image URLs. If a single image URL is provided, this image will open in a lightbox. If an array of image URLs are provided, the images will open in a lightbox gallery.

* The image URL should contain the full URL including http:// or https://. For example:

In addition to loading images from a custom field, we’ve also added a filter for more advanced functionality.

Filter adding featured image in case custom field is empty

You may have an instance when you have added images to your custom field on some posts but not others. The following filter assumes you have entered a custom field in the module’s settings. We then check if the custom field is empty for each post. If empty, show the featured image for the current post instead. If not empty, show the images in the custom field.

ACF gallery filter

The filter below will return an array of image URLs from the Advanced Custom Fields plugin gallery field. We are assuming in this example that the Return Format for the image gallery field in ACF is “Image Array” (default). If you have changed the return format to “Image URL” or “Image ID”, you’ll need to modify the function below to account for this. More info regarding the ACF gallery field can be found here.

Filter added to module with specific CSS ID

Here we are showing how you can return different images depending on the module’s CSS ID set in the Advanced tab of the module’s settings. You’ll need to replace custom_lightbox_images1 and custom_lightbox_images2 with the name of your custom fields containing the array of images.

In addition to using the module’s ID, you can also use the module’s Admin Label or Class.
Admin Label – found at the bottom of the module’s Content tab:


Class – found at the top of the Advanced tab:


Pin It on Pinterest

Share This