Gallery field render options
By default, Advanced Views displays the Gallery field using a row of <img> tags. You can customize the Layout template to change how it's rendered:
Note: Ensure in the provider group setting that the field return format is set to Image Array or Image ID. Choosing the Image URL doesn’t provide the necessary image dimensions.
1. Grid Gallery

The CSS grid feature is the easiest way to display Gallery images in a grid.
The example code below shows how to set this up. Change '2' to your desired number of columns in the grid-template-columns rule, and adjust the gap, which controls the space between items, from 20px to your preferred value:
Twig template:
CSS code:
2. Masonry Gallery (Pro)
From the Gallery layout dropdown, select the Classic or Flat masonry option and press the Update button.
The Classic masonry employs the Macy.js, while Flat uses a Flat Masonry script from Lightsource.
Optional: After saving, switch to the CSS & JS tab, and fine-tune the instance settings:
Macy.js

In the Masonry instance settings, you can fine-tune the number of columns, the gap between items (margin), and the responsive behavior. Check the Macy.js documentation to learn more.
Flat Layout

The flat masonry is a simple script, which offers only the basic settings, including gap between items and min-row height:
3. Carousel Gallery (Pro)

From the Gallery layout dropdown, select the Inline-Gallery option and press the Update button.
Optional: After saving, switch to the CSS & JS tab, and fine-tune the instance settings:
4. Slider Gallery (Pro)

From the Enable slider dropdown, select the Splide option and press Update. This option employs the Splide library, with the following defaults:
Displaying captions
In your Layout, copy the Default template content into the Custom template field and modify it as per the example below, by adding the image_item.caption usage:
Twig example:
Key Details
Caption Source: The
{{ image_item.caption }}tag pulls from WordPress’s native caption field (set in the media library).Splide Structure: The outer wrapper must still keep Splide’s structure:
div.splide > div.splide__track > ul.splide__list > li.splide__slide
Conditional Caption: Only renders the
<div class="caption">if a caption exists.
Caption Styling (Optional)
You can style the caption by adding this CSS to your Layout:
5. Lightbox Gallery (Pro)

Lightbox shows a zoom icon on image hover and allows readers to click and open an image in full-screen mode and switch between items if there are others.
From the Enable lightbox dropdown, select the LightGallery or Simple (no settings) option and press Update. The LightGallery option employs the LightGallery library, and has the following defaults:
6. FAQs
Last updated