[post_gallery]

The shortcode displays galleries in various layouts such as sliders or grids.


Product


Shortcode Attributes

GENERAL LAYOUT

  1. type – Determines the layout type of the gallery.
    • Default: slider.
    • Options: slider or grid. Specify one only.
  2. lightbox – Enables or disables the lightbox functionality for gallery images.
    • Default: off.
    • Options: on or off. Specify one only.

GRID LAYOUT

  1. per_row – Specifies the number of images to display per row in a grid layout.
    • Default: 3.

SLIDER LAYOUT

  1. thumbnails – Enables or disables thumbnails in the slider.
    • Default: off.
    • Options: on or off. Specify one only.
  2. thumb_to_show – Specifies the number of thumbnails to show in the slider.
    • Default: 3
  3. thumb_arrows – Enables or disables navigation arrows for the slider.
    • Default: on.
    • Options: on or off. Specify one only.
  4. thumb_dots – Enables or disables navigation dots for the slider.
    • Default: off.
    • Options: on or off. Specify one only.
  5. autoplay – Enables or disables autoplay for the slider.
    • Default: on.
    • Options: on or off. Specify one only.
  6. autoplay_speed – Specifies the autoplay speed in seconds.
    • Default: 6.

CONTENT

  1. source – Specifies the source of the gallery content.
    • Default: gallery.
    • Options: gallery, custom. Specify one only.
  2. id – Specifies the post ID to pull the gallery from (used when source="gallery").
    • Default: Current post ID.
  3. gallery – Specifies a custom gallery (used when source="custom").
  4. meta – Specifies metadata to display (e.g., title, categories, tags).
  5. content – Specifies the type of content to display (e.g., excerpt, full content).
    • Default: description.
    • Options: description, excerpt. Specify one only.
  6. max_words – Specifies the maximum number of words to display in the content.
    • Default: 20.
  7. 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.