Dynamic Galleries with Thumbnails and Captions in Lightbox using lightGallery in Bricks

Updated on 19 Apr 2024

This Pro tutorial provides the steps to load and initialize lightGallery on the images coming from a Gallery type of ACF field or an Image Advanced type of Meta Box field and being output using a Posts → Media Bricks query loop for a dynamic thumbnail gallery with support for thumbnails and captions inside the lightbox.

Note: The video was recorded before making a settings change to load the images in the correct order.

Step 1

Create a field group for your desired post type having a 'Gallery' type of field with ACF or an 'Image Advanced' type of field with Meta Box.

Meta Box screenshots:

Step 2

Edit your posts and upload/select images for your field.

Step 3

Edit your Page/template with Bricks and add a Section.

Inside the Section's Container, add a Container.

Change its HTML tag to ul.

Display: grid

Gap: 1em

Grid template columns: repeat(3, minmax(0, 1fr))

In the STYLE tab, go to CSS control group and add this class: lightgallery

Add a Block inside having a HTML tag of li and set Display to block.

Enable query loop.

Post type: Media

This is a BricksLabs Pro tutorial.

For full access login below or create your BricksLabs Pro account

Get access to all 525 Bricks code tutorials with BricksLabs Pro

Related Tutorials..

Pro
Programmatically populating ACF field values in WordPress

Programmatically populating ACF field values in WordPress

An example of how to set the values of a Select-type field with the names and labels of all public post types.
Categories:
Pro
6 Random Posts from Tag A + 6 Random Posts from Tag B in a Single Bricks Query Loop

6 Random Posts from Tag A + 6 Random Posts from Tag B in a Single Bricks Query Loop

Displaying two set of random posts, inside one query loop.
Categories:
Pro
Sort Posts by Meta Box Group Sub Field in Bricks

Sort Posts by Meta Box Group Sub Field in Bricks

This Pro tutorial provides the steps to order posts in Bricks by the value of a Number-type of sub field that is inside a Meta…
Loop Item ID and Loop Item Object in Bricks

Loop Item ID and Loop Item Object in Bricks

If you are working on a Bricks site with specific requirements, chances are you need to grab the ID and/or object of the current item…
Categories:
Pro
Excluding Duplicate Posts from Query Loops in Bricks

Excluding Duplicate Posts from Query Loops in Bricks

How to ensure that posts are not duplicated when two query loops are used on the same page.
Categories:
How to create parallax effects using Rellax.js in Bricks

How to create parallax effects using Rellax.js in Bricks

This tutorial provides the JS & PHP codes that can be pasted in order to create smooth parallax effects using the Rellax.js library inside Bricks…
Categories:
Pro
Meta Box/ACF Images Staggered Grid Gallery in Bricks

Meta Box/ACF Images Staggered Grid Gallery in Bricks

Showing images from two Gallery-type of ACF or Image Advanced-type of Meta Box fields in a staggered grid layout.