Envira Gallery Documentation

Documentation, Reference Materials and Tutorials for Envira Gallery

Dynamic Addon

Would you like to create galleries on the fly from within your page or post? Envira’s Dynamic Addon gives you the freedom to generate galleries without the need manual of intervention. It’s simple, fast and incredibly easy to do.

  1. Requirements
  2. Addon Compatibility
  3. Installation
  4. Setup
  5. Outputting a Dynamic Gallery
  6. Outputting a Dynamic Album
  7. Overriding Global Configuration Settings
  8. FAQs

At this time, the Dynamic Addon is not compatible with the Pagination Addon‘s AJAX pagination options, specifically:

  • On Pagination Click (AJAX)
  • On Button Click (AJAX)

Options to paginate your galleries.

Due to this limitation, you are unable to select the Display All Images in Lightbox? from the Pagination Tab:

Display All Images in Lightbox

Please follow our instructions on how to install and activate addons.

In this instance, you’ll be activating the Envira Dynamic Addon.

Once the Addon has been installed and activated, there will be a new gallery item named Envira Dynamic Gallery. This is used to define the default, global settings which are then used by any Envira Dynamic Gallery instance.

The settings configured for the Envira Dynamic Gallery only apply to Dynamic Galleries (that is, galleries created using the Dynamic shortcode or template tag).

Once activated, the Dynamic Addon will add a gallery item in the Envira Gallery List view which you can configure to control the default appearance of all Dynamic galleries.

For details on the available settings, please see the Creating Your First Envira Gallery document, which includes a breakdown of all available configuration options.

The Dynamic Addon can be used to create galleries from images in a number of different scenarios:

  1. Output the current Page/Post/CPT’s attached images
  2. Output specific images in the WordPress Media Library
  3. Images from a folder in the WordPress Content Directory
  4. Overriding the default WordPress Gallery output with an Envira Gallery
  5. Output images from a NextGen Gallery
  6. Output Gallery from specified Tag(s) (if the Tags Addon is activated).

There are two methods available to output an Envira Dynamic Gallery:

  • shortcode
  • template tag

The shortcode output is typically used within a Visual Editor on your WordPress Page, Post or Custom Post Type, and is:

The template tag output is typically used within your WordPress Theme’s PHP code, and is:

Shortcodes and template tags accept a number of configuration options (or arguments) to customize the output of the gallery: [envira-gallery-dynamic id="tags-food"].

For any shortcode example shown below, such as this one: [envira-gallery-dynamic id="custom-XXX" images="600,601,602"] please make sure you aren’t using any characters for your custom-name. Characters such as #, ‘, / etc may cause display issues with your gallery.

Output the current Page/Post/CPT’s attached images

[envira-gallery-dynamic id="123"]

Template Tag:
envira_dynamic( array( 'id' => 123 ) );


  1. Replace ‘123’ with your Page/Post/CPT’s ID.


Output specific images in the WordPress Media Library

[envira-gallery-dynamic id="custom-XXX" images="600,601,602"]

Template Tag:
envira_dynamic( array( 'id' => 'custom-XXX', 'images' => '600,601,602' ) );


  1. Replace ‘XXX’ with a unique name (this can be anything).
  2. Set the ‘images’ parameter to be a comma separated list of Media Library attachment IDs.


Images from a folder in the WordPress Content Directory

[envira-gallery-dynamic id="folder-gallery"]

Template Tag:
envira_dynamic( array( 'id' => 'folder-gallery' ) );


  1. The folder name begins after folder-; in the example above you would need a folder called gallery inside your wp-content folder.
  2. The parent folder must be directly within the wp-content directory e.g. wp-content/gallery. Subdirectories (wp-content/gallery/gallery) will also work.
  3. Files within the folder must not contain spaces. For best compatibility, stick to alphanumeric characters
  4. JPG, JPEG, PNG and GIF images are supported
  5. Performance may be slower than adding your images to an Envira Gallery – this should only be used for a small number of images.

Simply check this on your Envira Dynamic Gallery and you’re all set!

You can easily render all WordPress galleries into Envira galleries with the click of a single setting.

Output images from a NextGen Gallery

[envira-gallery-dynamic id="nextgen-ID"]

Template Tag:
envira_dynamic( array( 'id' => 'nextgen-ID' ) );


  1. Replace ‘nextgen-ID’ with the ID of your NextGen Gallery.

To output images from a NextGEN gallery you'll need to include the gallery ID.

Output Gallery from specified Tag(s)

See our guide on how to populate a Dynamic gallery from Tags: Display a Tag Based Dynamic Gallery

[envira-gallery-dynamic id="tags-food"]

Please remember that you will need to make sure to place the id="tags-before you enter your tags. If you would like to add more than 1 tag in your gallery, you would separate the remaining tags with a comma like this [envira-gallery-dynamic id="tags-balloons,buildings"].

The Dynamic Addon can also be used to create albums from:

  1. Output Album from specified Envira Gallery IDs
  2. Output Album comprising of all Envira Galleries

[envira-album-dynamic id="custom-XXX" galleries="607,611"]

Template Tag:
envira_dynamic_album( array( 'id' => 'custom-XXX', 'galleries' => '607,611' ) );


  1. Replace ‘XXX’ with a unique name (this can be anything).
  2. Set the ‘galleries’ parameter to be a comma separated list of Envira Gallery IDs.

Output Album comprising of all Envira Galleries

[envira-album-dynamic id="custom-XXX" galleries="all"]

Template Tag:
envira_dynamic_album( array( 'id' => 'custom-XXX', 'galleries' => 'all' ) );


  1. Replace ‘XXX’ with a unique name (this can be anything).
  2. Set the ‘galleries’ parameter = all.
Please be aware if you are using this shortcode and have several hundred galleries, this could cause time outs on your page and not all images will load.

By default, each Envira Dynamic Gallery will use the settings defined in the Envira Dynamic Gallery item found at WordPress Administration » Envira Gallery.

To override one or more settings on a per-dynamic gallery basis, add the Programmatic Name parameter(s) to your shortcode or template tag. These can be found in the Configuring your Gallery Documentation.  For example:

[envira-gallery-dynamic id="custom-ID" images="600,601,602" columns="6" gallery_theme="base" display_description="1"]

Template Tag:
envira_dynamic( array( 'id' => 'custom-ID', 'images' => '600,601,602', 'columns' => 6, 'gallery_theme' => 'base', 'display_description' => 1 ) );

A: This option is not available when using the Base (Dark) or Base (Light) lightbox theme.

A: Currently the only pagination ‘type’ that can be used for Dynamic galleries is the “On Pagination Click, reloading Page”.

Use On Pagination Click, reloading Page for dynamic paginated galleries.

A: Currently the watermarking tab is unavailable for dynamic galleries. Since the gallery is dynamic Envira does not currently have a way to confirm if the image has already been watermarked.

A: Dynamic galleries pulling from a folder will only look for images from the folder specified in the shortcode. It will not look into any subdirectories for additional images. If you are wanting to pull the images from a subdirectory, you will need to specify that subdirectory like so: [envira-gallery-dynamic id="folder-gallery/subdirectory"].

A: For best practices when naming your dynamic shortcodes, it’s always best to not use any characters that can be seen as possible code. Things like semi-colons, colons, commas or number signs should be avoided.

A: In order to create a dynamic tagged gallery, those images you want to display from your tag must already be included in an Envira gallery.

A: First, make sure that the Password Protection Addon is enabled. Once this is done, you can add the proper attributes to the Dynamic shortcode to password protect your galleries. You can define a username or email using the password_protection_email attribute and a password using the password.

Here’s an example: [envira-gallery-dynamic id="410" password_protection_email="you@you.com" password="123"]

Note: Both attributes will need to be used for your galleries to be protected.

A: In certain circumstances, transient cache may cause issues with images in Dynamic Galleries. Please follow the guide for Disabling the Fragment Cache. This may resolve your issue!

A: Absolutely! You can follow along with these docs on categorizing your galleries and then add your shortcode to any post, page or widget like this:
[envira-album-dynamic id="tags-featured-galleries"]

Just remember to change the tags-featured-galleries to match the slug name of the category you chose for your galleries:
Envira Dynamic Album using Envira Categories


1.5.3 (05-30-2018)

  • Fix: Minor bug fixes.

1.5.1 (05-01-2018)

  • Fix: Minor bug fixes.

1.4.1 (11-23-2017)

  • Fix: Dynamic generating extra image sizes
  • Fix: Tags Compatibility
  • Fix: Render WordPress galleries
  • Fix: Returning wrong cached gallery
  • Fix: Minor bug fixes.

1.4.0 (10-18-2017)

  • Fix: Dynamic Images duplicating
  • Fix: Password Protection preventing gallery view
  • Fix: Dynamic shortcode to include all tags
  • Fix: Shortcode with multiple tags
  • Fix: Minor bug fixes

1.3.0 (08-22-2017)

  • Fixed: Include all tags shortcode
  • Fixed: Conflict with Single tags and settings

1.2.9 (08-08-2017)

  • Fixed: compatibility with pagination
  • Fixed: Conflict with Album Categories not displaying all.
  • Fixed: Caption and titles in lightbox view
  • Added: Use Dynamic Tags without displaying tags.

1.2.8 (04-04-2017)

  • Added: Support for custom IDS
  • Added: Support for External URLS
  • Fix: Minor bug fixes.

1.2.7 (02-15-2017)

  • Added: Support for nested directories
  • Fix: Minor bug fixes.

1.2.6 (02-01-2017)

  • Fix: Minor bug fixes.

1.2.5 (01-19-2017)

  • Fix: Dynamic folders support hyphens.

1.2.4 (2017-01-10)

  • Minor bug fixes

1.2.3 (2016-12-08)

  • Fix: Envira Pagination compatibility
  • Fix: Dynamic Album galleries=“all” not displaying

1.2.2 (2016-11-03)

  • Added: Defaults arg to shortcode, users can now pull settings from other galleries and albums Envira Download.
  • Fix: Support for download addons.
  • Fix: Support on multisite
  • Fix: Defaults not being set on activation.

1.2.1 (2016-10-04)

  • Fix: Resolving compatibility issues with download addon.
  • Update: Only display "Render All WordPress Galleries” option in the main dynamic gallery settings.

1.2 (2016-09-22)

  • Fix: Added "All Envira Galleries" to automatic layout for galleries.

1.1.9 (2016-08-25)

  • Updated: Spanish translations

1.1.8 (2016-06-02)

  • Fixed: No duplications of retina images in dynamic folder

1.1.7 (2016-04-28)

  • Updated: Spanish Translations

1.1.6 (2016-04-21)

  • Added: Option to override all WordPress Galleries with Envira Galleries
  • Updated: Spanish translation

1.1.5 (2016-04-14)

  • Fix: Help Video no longer exceeds meta box container.

1.1.4 (2016-03-31)

  • Added: Better description on the Images tab, with YouTube video and button linking to Documentation

1.1.3 (2016-02-26)

  • Fix: Remove gallery ID debugging output

1.1.2 (2016-02-25)

  • Updated: Spanish Translations

1.1.1 (2016-02-04)

  • Fix: Honour all Dynamic Gallery settings by populating image set earlier in the process. Developers: $data is applied using envira_gallery_custom_gallery_data, not envira_gallery_pre_data. Should’t break anything, as we’re just populating image data earlier in the shortcode routine.

1.1.0 (2015-12-23)

  • Fix: Call correct activation routines on multisite activation

1.0.9 (2015-12-10)

  • Added: Spanish Translation

1.0.8 (2015-10-14)

  • Fix: Automatically create Default Gallery and Album on new site activation in Multisite Network
  • Fix: Use wp_get_sites() on initial activation rather than raw SQL query

1.0.7 (2015-10-01)

  • Fix: Prevent fatal error if Envira_Albums_Common can’t be found on plugin activation

1.0.6 (2015-07-16)

  • Fix: Register envira_dynamic_album() by checking if envira_dynamic_album() already exists, not if envira_dynamic() already exists.
  • Fix: Albums - check if galleries have images, and skip if not


  • Fix: NextGen 2.1.x+ compatibility


  • Added: all keyword can now be specified in place of gallery IDs when generating a Dynamic Album. This will generate an album comprising of all published Galleries.


  • Fix: Lightbox thumbnail generation for folder-based dynamic galleries.


  • Fix: Thumbnails not generated for Lightbox.


  • Fix: Check if Albums Addon activated during Dynamic Addon activation routine. If not, don’t generate a Dynamic Album.


  • Initial release of the addon.