Display WordPress Gallery Captions in a Splide Slide
If you're using Advanced Views Pro, you can create beautiful sliders using Splide and display each image’s built-in WordPress caption below the image.
What You’ll Need
Step 1: Use the Correct Template Structure
<avf-layout-66b5d4134a54e class="{{ _layout.classes }} avf-layout
avf-layout--id--{{ _layout.id }} avf-layout--object-id--{{ _layout.object_id }}">
{% if gallery.value %}
<div class="avf-layout__gallery2 splide">
<div class="splide__track">
<ul class="avf-layout__gallery2-list splide__list">
{% for image_item in gallery.value %}
<li class="avf-layout__gallery2-item splide__slide">
<img class="avf-layout__gallery2-image" src="{{ image_item.value }}" width="{{ image_item.width }}" height="{{ image_item.height }}" alt="{{ image_item.alt }}" decoding="{{ image_item.decoding }}" loading="{{ image_item.loading }}" srcset="{{ image_item.srcset }}" sizes="{{ image_item.sizes }}">
{% if image_item.caption %}<div class="caption">{{ image_item.caption }}</div>{% endif %}
</li>
{% endfor %}
</ul>
</div>
</div>
{% endif %}
</<avf-layout-66b5d4134a54e>Key Details
Step 2: Add Caption Styling (Optional)
Step 3: Test and Tweak
Last updated