[post_gallery]
The shortcode displays galleries in various layouts such as sliders or grids.
Product
Shortcode Attributes
GENERAL LAYOUT
type– Determines the layout type of the gallery.- Default:
slider. - Options:
sliderorgrid. Specify one only.
- Default:
- lightbox – Enables or disables the lightbox functionality for gallery images.
- Default:
off. - Options:
onoroff. Specify one only.
- Default:
GRID LAYOUT
- per_row – Specifies the number of images to display per row in a grid layout.
- Default:
3.
- Default:
SLIDER LAYOUT
- thumbnails – Enables or disables thumbnails in the slider.
- Default:
off. - Options:
onoroff. Specify one only.
- Default:
- thumb_to_show – Specifies the number of thumbnails to show in the slider.
- Default:
3
- Default:
- thumb_arrows – Enables or disables navigation arrows for the slider.
- Default:
on. - Options:
onoroff. Specify one only.
- Default:
- thumb_dots – Enables or disables navigation dots for the slider.
- Default:
off. - Options:
onoroff. Specify one only.
- Default:
- autoplay – Enables or disables autoplay for the slider.
- Default:
on. - Options:
onoroff. Specify one only.
- Default:
- autoplay_speed – Specifies the autoplay speed in seconds.
- Default:
6.
- Default:
CONTENT
- source – Specifies the source of the gallery content.
- Default:
gallery. - Options:
gallery,custom. Specify one only.
- Default:
- id – Specifies the post ID to pull the gallery from (used when
source="gallery").- Default: Current post ID.
- gallery – Specifies a custom gallery (used when
source="custom"). - meta – Specifies metadata to display (e.g., title, categories, tags).
- content – Specifies the type of content to display (e.g., excerpt, full content).
- Default:
description. - Options:
description,excerpt. Specify one only.
- Default:
- max_words – Specifies the maximum number of words to display in the content.
- Default:
20.
- Default:
- name – Specifies a custom name for the gallery (used when
source="custom").
Example Usage
Example
[post_gallery]
[post_gallery id="123"]
[post_gallery source="custom" gallery="image1.jpg,image2.jpg"]
[post_gallery type="grid" lightbox="on" per_row="4"]
[post_gallery type="slider" thumbnails="on" autoplay="on" autoplay_speed="10"]
Results
| Example1: This example displays a gallery from the current post. Example2: This example displays a gallery from a specific post. Example3: This example displays a custom gallery. Example4: This example displays a grid layout with lightbox. Example5: This example displays a slider with autoplay and thumbnails. |