Envira Gallery Documentation

Documentation, Reference Materials and Tutorials for Envira Gallery

Dynamic Addon

The Dynamic Addon will allow you to easily create dynamic galleries and albums on the fly. This article will help walk you through the many ways in which you can quickly and easily create dynamic galleries.

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

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

Step 1 – Edit Envira Dynamic Gallery

Your first step is to navigate to the WordPress Admin » Envira Gallery and select the Envira Dynamic Gallery to edit the gallery.

Edit the Envira Dynamic Settings gallery to setup and use the Dynamic Addon

Step 2 – Configure your settings

Your next step is to set up your dynamic settings. Simply navigate through each tab of the gallery and create your base settings that will be used for all dynamic galleries.

Step 3 – Publish the Envira Dynamic Gallery

Finally, you’ll just need to click Publish or Update on your gallery to save any changes you’ve made to your default gallery settings.

Once you’ve completed these steps for galleries, you can repeat these same steps for albums if you’re planning on creating dynamic albums.

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).
For any shortcode examples shown below where the gallery id name is XXX, this is only an example. ALL dynamic gallery ID names should always be unique each time it’s used or this could cause confusion and mixed results.
Output the current Page/Post/CPT’s attached images

To use this type of a dynamic gallery. You’ll first need to create a new page or post on your site. Then just click the Add Media button to upload images to your post. WordPress will only consider an image attached to a post if it’s uploaded directly and not simply selecting it from the Media Library and inserting it.

Once you’ve uploaded your images, click Publish on the post.

In the browser bar you’ll see the ID number that WordPress assigned and that is the number you’ll need for your dynamic gallery.

For example, if the URL shows this https://yoursite.com/wp-admin/post.php?post=62602&action=edit, your dynamic shortcode would look like what’s shown below.

Simply add your shortcode to the page and click Update. When you visit the page, you’ll now see the dynamic gallery.

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

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

Output specific images in the WordPress Media Library

Very similar to the process above, you can go to your WordPress admin » Media » Library and find your image ID by looking at the browser URL.

In this example, the URL while viewing the image is https://yoursite.com/wp-admin/upload.php?item=445707.

Therefore on the images portion of the shortcode, you’d place the 445707 number as one of the image IDs.

You can also install and activate the Show IDs plugin to see a list from the Media’s List view of the actual image ID in the ID column.

Find the ID of the images you want to include in your dynamic gallery

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

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

Images from a folder in the WordPress Content Directory

Creating this type of dynamic gallery is a little more technical as the others as it requires direct access to your server files by creating directories inside your /wp-content directory.

If you unsure what that actually means, it may be best to find an alternative option for creating your dynamic gallery.

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

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

Some important tips to remember:

  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.

This is likely the easiest dynamic gallery you can create. If you’ve spent countless hours setting up your WordPress galleries then you really don’t want to recreate all of your galleries again.

To convert your WordPress galleries into Envira Dynamic galleries, just look for the option on the Configuration tab of the Envira Dyanmic Settings to Render all WordPress Galleries using Envira? and this will automatically take any WordPress gallery and change it to an Envira dynamic gallery using the settings from the Envira Dynamic Settings.

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

There’s nothing more you need to do with adding a shortcode and this is why this is one of the easiest ways to create a dynamic gallery!

Note: This will not work if the gallery was created in the Gutenberg editor. It must be created in the classic editor. Keep checking back for an update on this.

Output images from a NextGen Gallery

As with the WordPress galleries, Envira has also realized that maybe you want to change over your NextGen galleries as well without the need to recreate.

You can easily use the Envira NextGen Importer Addon to import your NextGen galleries or you can also create a dynamic gallery by following the shortode example below, just add a shortcode to your page using the NextGen Gallery ID number. Just be sure to update the NextGen ID number with the ID number for your own NextGen galleries.

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

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

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

Output Gallery from specified Tag(s)

Creating a tag based dynamic gallery using Envira’s Tags Addon is probably our most popular way. We have a more detailed articlet on Display a Tag Based Dynamic Gallery that you may also find helpful.

But for example, let’s say you tagged some of your images with the tag food. An example of that dynamic shortcode would look like what’s shown below.

[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. Create a Dynamic Album from specified Envira Gallery IDs
  2. Output Album comprising of all Envira Galleries

This example would be to create a dynamic album with specific gallery ID nubmers.

If you’re not sure where to find your gallery ID number, check out our article on How do I find my Envira Gallery ID Number.

Once you know your gallery ID number, your shortcode would look something like what’s shown below. Just be sure to separate each gallery ID number with a comma (no spaces needed).

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

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

Output Album comprising of all Envira Galleries

If you wanted to create a dynamic album that shows all of your Envira galleries, an example of that shortcode is shown below. Just be sure to keep the ID for the album unique.

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

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

Some important tips to remember:

  1. Replace ‘XXX’ with a unique name (this can be anything).
  2. Set the ‘galleries’ parameter = all.
  3. If you have several hundred galleries and create this type of dynamic album, this could cause slowness or timeouts on the site..

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 Watermark 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: First, make sure that the Password Protection Addon is enabled.

Once this is done, you can add the correct information to the Dynamic shortcode to password protect your galleries. You’ll be able to set a username or email using the password_protection_email option and a password using the password.

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

A: Transient cache may cause issues with images in Dynamic Galleries. Please follow the guide for Disabling the Fragment Cache.

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

A: You can absolutely use the Albums Addon and create a dynamic album that would pull the latest 4 galleries.

Just add this shortcode to your page and remember to change the name each time you want to use this type of shortcode.

[envira-album-dynamic id="custom=pulllatest5gals" limit="4" orderby="date" order="desc"]

With that above shortcode we’re pulling in the last 4 galleries.

A: Absolutely! You would need to add a bit more to the shortcode to specify the image ID from the step above, but you would also need to specify each URL for each image (in order) like this example:
[envira-gallery-dynamic id="custom-id-external-links-123" images="5272,5271,5270" external="https://www.apple.com/itunes/,https://www.shopdisney.com/,http://amazon.com"]

A: Unfortunately not at this time.


1.5.6 (02-05-2020)

  • Fix: Plugin updater revised.

1.5.5 (10-23-2019)

  • Fix: Sorting dynamic images in some cases now resolved.

1.5.4 (06-05-2019)

  • Fix: Code clean up, minor bug fixes, enhanced security.

1.5.4 (10-16-2018)

  • Enhancement: "Pull Latest X" galleries now possible via shortcode with limit, orderby (date is default), order (desc is default), and offset (0 is default).
  • Fix: In some rare cases dynamic folder was from pulling in images from WordPress media, now resolved
  • Fix: Now sorts images by publish date when pulling from the /wp-content/XXX directory.
  • Fix: Improved santitization for developers using envira_dynamic().

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.