Envira Gallery Documentation

Documentation, Reference Materials and Tutorials for Envira Gallery

Dynamic Addon

Sometimes, a straightforward image gallery just won’t cut it. When you need to create a gallery with images from specific posts on your website, or you need to override the default WordPress gallery with the Envira gallery engine, you need a stronger tool. That’s why we created the Dynamic Addon, a feature that allows you to create dynamic galleries — and albums — on the fly.

When you want to be able to quickly create a gallery without re-uploading images, changing out data, and formatting the gallery layout, you can use the Dynamic Addon to save time.

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

First, navigate to your WordPress Admin Dashboard, then select the Envira Gallery tab. From the Envira Gallery plugin page, select the Envira Dynamic Gallery to edit the gallery. Envira Gallery automatically drafts this dynamic gallery for you when you activate the addon.

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

Step 2 – Configure your settings

Now, you’ll need to establish your dynamic settings. Simply navigate through each tab of the gallery and create your base dynamic settings. Envira Gallery will apply these settings to all dynamic galleries you create.

Customizations you can make include Lightbox and mobile gallery settings, standalone options, general and miscellaneous configuration, and other options, depending on any other addons you may also be using.

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 dynamic gallery settings.

Once you’ve completed these steps for configuring dynamic galleries, you can repeat these same steps for creating dynamic albums if you’re using the Albums Addon.

You can also use the Dynamic Addon to create galleries from images in a number of different scenarios, including:

  1. Output the current Page/Post/CPT’s attached images
  2. Output specific images in the WordPress Media Library
  3. Import images from a folder in the WordPress Content Directory
  4. Override 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

The Dynamic Addon allows you to create Envira galleries from images already on a page, post or CPT. To create this type of dynamic gallery, you’ll first need to create a new page or post on your site from your WordPress Admin dashbaord.

Click the plus icon to add an Image block using WordPress’ Gutenberg editor, then click the Upload button to upload images to the page or post you’re creating. WordPress will only consider an image attached to a post if it’s uploaded to that post directly. In other words, if you simply select it from the Media Library, WordPress will not consider that image attached to the post.

Once you’ve uploaded your images, click Publish to launch the page or post.

In the browser bar for the page or post you’ve just made, you’ll see an ID number that WordPress has assigned. Note this number, as you’ll need it for your dynamic gallery.

Next, simply add the following shortcode to the page and click Update.

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:

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

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

Now, when you visit the page or post, you’ll see your dynamic gallery.

Output Specific Images in the WordPress Media Library

Using a very similar process to the one above, you can create a dynamic gallery from specific images in your Media Library. Simply go to your WordPress Admin » Media » Library and find the image ID of the photo you want to add to your gallery by looking at the browser URL.

In this example, the URL while viewing the image we want to add is https://yoursite.com/wp-admin/upload.php?item=445707. In this instance, the image ID is 445707. We’ll use this ID in the shortcode to create the dynamic gallery.

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

Now, just paste your shortcode into the page or post on which you want to create your dynamic gallery. Make sure to input the image ID:

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

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

Import Images from a Folder in the WordPress Content Directory

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

If you don’t have prior experience with WordPress directories, it may be best to find an alternative option for creating this type of dynamic gallery.

Locate the folder in your /wp-content directory that contains your image, or create a new one to hold the images. Then, use the shortcode below to create your dynamic gallery:

Shortcode:
[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. In our example, the folder is called gallery, which is inside the 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 by this kind of dynamic gallery.
  5. Performance may be slower than adding your images to an Envira Gallery. Only use this dynamic gallery method for displaying 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 before you purchased Envira, you don’t want to have to recreate them all from scratch. We don’t want you to waste that kind of time, either, so we’ll show you how to override the default output to make them into Envira dynamic galleries using the Dynamic Addon.

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? Check this box, which 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.

This is one of the easiest dynamic galleries to create because it doesn’t require any shortcode!

Note: Currently, this solution will not work if you created your WordPress galleries using the Gutenberg editor. It must have been created in the Classic editor to convert using this method.

Output Images from a NextGen Gallery

You can also use the Dynamic Addon to convert your NextGEN galleries to Envira galleries without recreating them.

You can easily use the Envira NextGEN Importer Addon to import your NextGEN galleries, or you can create a dynamic gallery by adding a shortcode to your page using your NextGEN gallery’s ID number:

Shortcode:
[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 Specific Tag(s)

Creating a tag-based dynamic gallery using Envira’s Tags Addon is probably the easiest way to achieve this solution. We have a more detailed article on how to Display a Tag Based Dynamic Gallery that you may also find helpful.

But, you can create this gallery using the Dynamic Addon, too. For example, let’s say you tagged some of your images with the tag food. You could paste the following shortcode into a page or post to display a dynamic gallery that includes all photos tagged food.

Shortcode:
[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. Specified Envira Gallery IDs
  2. All Envira Galleries

To create a dynamic album that contains certain Envira galleries on your site, locate the gallery ID numbers of all the galleries you wish to include in the album.

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, paste the shortcode below into your page or post, including your unique gallery ID. Just be sure to separate each gallery ID number with a comma (no spaces needed).

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

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

Output a Dynamic Album Comprised of all Envira Galleries

If you wanted to create a dynamic album that shows all of your Envira galleries, use the following shortcode. Just be sure to keep the ID for the album unique.

Shortcode:
[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. Envira does not currently have a way to confirm if images in dynamic galleries have 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 want to pull images from a subdirectory, you will need to specify that subdirectory in the shortcode, like so: [envira-gallery-dynamic id="folder-gallery/subdirectory"].


A: For best practices when naming your dynamic shortcodes, it’s best not to 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 you’ve enabled the addon, 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 use the Albums Addon to create a dynamic album that pulls your latest 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"]

The shortcode above pulls in the last 4 galleries, but you can change the number of galleries it pulls by setting a differentlimit.


A: Absolutely! You’ll need to add a bit more to the shortcode to specify the image ID from the step above, and you’ll 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, the Dynamic Addon and the Videos Addon are not compatible at this time.

Changelog

1.5.9 (09-16-2020)

  • Fix: Better compatibility with Envira 1.9.0.

1.5.8 (07-23-2020)

  • Fix: Do not allow dynamic gallery to be published.

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

1.0.5

  • Fix: NextGen 2.1.x+ compatibility

1.0.4

  • 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.

1.0.3

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

1.0.2

  • Fix: Thumbnails not generated for Lightbox.

1.0.1

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

1.0.0

  • Initial release of the addon.
[i]
[i]