Shortcode

The Dynamic Galleries Addon extends WordPress’ native [gallery] shortcode, by providing support for additional shortcode attributes, allowing dynamic galleries to be built.

There are two ways to insert Dynamic Galleries into your content:

  • Using the Insert Dynamic Gallery button
  • Manually adding attributes to your existing [gallery]

When editing a Page, Post or Custom Post Type using the TinyMCE Classic Editor, you’ll see a button to the right of the Add Media button above the Visual Editor:
Media Library Organiser: Dynamic Galleries: Insert Dynamic Gallery Button

Click this button, and a modal dialog window will be displayed, where you can specify several attributes for your Gallery:
Media Library Organiser: Dynamic Galleries: Insert Dynamic Gallery Modal

Query Options

Attribute Description
Include Categories Start typing to search and specify one or more Categories.  Images will be displayed that are assigned to these Categories.
Include Categories Operator Determines whether Images should have all or any of the Categories above assigned to be eligible for display in the Gallery.
Exclude Categories Start typing to search and specify one or more Categories.  Images will be displayed that are not assigned to these Categories.
Exclude Categories Operator Determines whether Images should not have all or any of the Categories above assigned to be eligible for display in the Gallery.
Include Author(s) Start typing to search and specify one or more WordPress Usernames.  Images will be displayed that were uploaded by user(s) chosen here.
Exclude Author(s) Start typing to search and specify one or more WordPress Usernames.  Images will be displayed that were not uploaded by user(s) chosen here.
Search Terms Specify freeform search terms or words.  Images will be displayed that contain these search terms in the Title, Caption, Alt Text or Description.
Total Number of Images (per Page) The maximum number of Images to display in the Gallery.  When Pagination is enabled, this setting becomes the maximum number of Images to display per Page in the Gallery.

Pagination Options

Attribute Description
Enable Pagination When checked / selected, pagination will be displayed if the Total Number of Images (per Page) setting is less than the total number of Images in the Gallery.
Pagination Position If Pagination is enabled, whether to display the Pagination above, below or above and below the Gallery.
Previous Link Label The text to display for the Previous Page Link in the Pagination.
Next Link Label The text to display for the Next Page Link in the Pagination.

Display Options

Attribute Description
Order Determines how to order the output of images found based on the above attributes.
Link To What each image should link to.
Columns The number of columns to display in the Gallery.
Size The size to display for each image.  Sizes are WordPress registered image sizes.

Once you have defined the Dynamic Gallery settings, click the Insert Dynamic Gallery button.

A [gallery] shortcode will then appear in the TinyMCE Editor, comprising of the attributes defined above.

Manually Adding Attributes to existing Galleries

As the Dynamic Galleries Addon works with WordPress’ [gallery] shortcode, you can add attributes to existing [gallery] shortcodes, turning them into dynamic galleries.

To add one or more attributes, refer to the below table.

Parameter Accepted Value Description
mlo-category_in Term ID(s)
Term Name(s)
Term Slug(s)
Images will be displayed that are assigned to these Categories.  To specify more than one Category, separate values with a comma.

Term ID(s): 1,2,3
Term Name(s): Category A,Category B,Category C
Term Slug(s): category-a,category-b,category-c

mlo-category_in_operator string Determines whether Images should have all or any of the Categories above assigned to be eligible for display in the Gallery.

all: All Categories in mlo-category_in must be assigned to each Image
any: Any Category in mlo-category_in must be assigned to each Image

mlo-category_not_in Term ID(s)
Term Name(s)
Term Slug(s)
Images will be displayed that are not assigned to these Categories.  To specify more than one Category, separate values with a comma.

Term ID(s): 1,2,3
Term Name(s): Category A,Category B,Category C
Term Slug(s): category-a,category-b,category-c

mlo-category_not_in_operator string Determines whether Images should have all or any of the Categories above assigned to be excluded from display in the Gallery.

all: All Categories in mlo-category_in must be assigned to each Image for the Image not to be displayed in the Gallery
any: Any Category in mlo-category_in must be assigned to each Image for the Image not to be displayed in the Gallery

author_in string Images will be displayed that were uploaded by user(s) specified.

To specify multiple Users, separate usernames with a comma.

author_not_in string Images will be displayed that were not uploaded by user(s) specified.

To specify multiple Users, separate usernames with a comma.

s string Specify freeform search terms or words.  Images will be displayed that contain these search terms in the Title, Caption, Alt Text or Description.
posts_per_page integer The maximum number of Images to display in the Gallery.

0, or omitting this attribute, means no limit.

When Pagination is enabled, this setting becomes the maximum number of Images to display per Page in the Gallery.

pagination integer 1: Pagination will be displayed if the Total Number of Images (per Page) setting is less than the total number of Images in the Gallery.
0: Pagination will not be displayed.
pagination_position string top: If Pagination is enabled, it will be displayed above the Gallery.
bottom: If Pagination is enabled, it will be displayed below the Gallery.
top_bottom: If Pagination is enabled, it will be displayed both above and below the Gallery.
pagination_prev_label string The text to display for the Previous Page Link in the Pagination.
pagination_next_label string The text to display for the Next Page Link in the Pagination.
orderby string Determines how to order the output of images found based on the above attributes.
ID: Attachment ID
author: Author (Uploader)
date: Date
name:  Filename
modified: Modified Date
parent: Uploaded to (i.e. the Page / Post / CPT the Attachment was uploaded to)
title: Title
post_date: Uploaded Date
order string Determines the order of images found based on the above attributes.
asc: Ascending (A to Z, low to high)
desc: Descending (Z to A, high to low)
link_to string What each image should link to.
none: Do not link,
file: Media / Image File
post: Attachment Page
columns integer The number of columns to display in the Gallery.  Any value between 1 and 6 is accepted.
size string The size to display for each image.  Sizes are WordPress registered image sizes; you may have additional choices depending on your own site.
thumbnail: Thumbnail
medium: Medium
large: Large
full:  Full Size

Example Shortcode Usage

Display all Images matching the Category Name “Vehicle”

[gallery mlo-category_in="Vehicle"]

Display all Images matching the Category Name “Vehicle” OR “Car”

[gallery mlo-category_in="Vehicle,Car"]

Display all Images matching the Category Name “Vehicle” AND “Car”

[gallery mlo-category_in="Vehicle,Car" mlo-category_in="AND"]

Display all Images matching the Category Name “Vehicle”, but excluding Images matching the Category Name “Car”

[gallery mlo-category_in="Vehicle" mlo-category_not_in="Car"]

Display all Images containing “car” in the Title

[gallery s="car"]