Envira Gallery Blog

Digital Photography Tips, Tutorials and Resources

How to Automatically Create Dynamic Image Galleries in Envira

How to Automatically Create Dynamic Image Galleries in Envira

Last updated on Apr 6, 2017 by Waseem Abbas Reader Disclosure

Are you looking for a solution to create image galleries automatically? Dynamic WordPress galleries are more powerful and faster to create. In this article, we will share how to automatically create dynamic image galleries in Envira.

What is the Dynamic Addon?

By default, there is no option in WordPress to create dynamic image galleries. Since many of you emailed us about it, we added this feature to Envira Gallery.

To create dynamic galleries with Envira, you’ll need the Dynamic WordPress Gallery Addon.

The Dynamic Addon is a feature of Envira Gallery that helps you create WordPress galleries on the fly based on your specifications.

To use it, all you need to do is customize a bit of code (explained below).

How to Create Dynamic Image Galleries

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:
[[envira-gallery-dynamic]]

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

Shortcodes and template tags accept a number of configuration options to customize the output of the gallery…

1. Using the Current Page/Post/CPT’s Attached Images

You can automatically create an image gallery with the photos from a WordPress page, post, or custom post types.

Shortcode:

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

Template Tag:

envira_dynamic( array( 'id' => xx ) );

Simply replace the ‘xx’ with your page or post ID.

2. Using Specific Images in the WordPress Media Library

You can use previously uploaded images from your WordPress media library.

Shortcode:

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

Template Tag:

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

You’ll need to replace ‘XXX’ with a unique name, and ‘images’ with the image attachment IDs from your WordPress media library. Image IDs will be comma separated, as shown in the above example.

3. Using Images from a Folder in the WordPress Content Directory

You can use images stored in a specific folder to create your gallery. For instance, you can create a folder in your wp-content directory and name it gallery. Then you would use one of the following:

Shortcode:

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

Template Tag:

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

Make sure that the gallery folder is located directly within the wp-content directory. No other directories or sub-directories will work for this code. Filed within the folder must not contain spaces. Also, performance may be slower using this method, so only use for a small number of images.

4. Overriding the Default WordPress Gallery Output with an Envira Gallery

If you are using a default WordPress image gallery, then you can override it with Envira Gallery using the Dynamic Addon.

Simply use the following shortcode in your post or page where you have the WordPress image gallery:

Shortcode:

[[gallery ids="700,699,686" envira="true" envira_gallery_args="isotope=0&crop=0"]]

You need to replace the ‘ids’ with the image attachment IDs.

Aside from that, envira_gallery_args is an optional attribute. It comprises of key/value pairs in the string format (arg1=x&arg2=y…) that refer to the Overriding Global Configuration Settings for the available key/value pairs.

5. Using Images From a NextGen Gallery

You can make dynamic image galleries using your NextGen gallery.

Shortcode:

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

Template Tag:

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

You need to replace the ‘nextgen-ID’ with the ID of your NextGen Gallery.

6. Using Images with Specified Tags

If you are using Envira’s Tags Addon, then you can create dynamic image galleries with specific tags.

Shortcode:

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

Template Tag:

envira_dynamic( array( 'id' => 'tags-XXX' ) );

You need to replace ‘xxx’ with the tag name to retrieve images for your dynamic gallery. (Learn more about how to create WordPress galleries based on tags.)

If you have any other case where you would like to create a dynamic gallery, then please do share with us!

Creating Dynamic Image Galleries in Envira

First, you need Envira’s Dynamic Addon to create dynamic WordPress galleries.

To access this addon, you must have Envira’s Pro or Ultimate license.

You can go to Envira Gallery » Addons to install and activate the Dynamic Addon.

Dynamic Addon

Upon activating the addon, you can go to Envira Gallery. You will see a pre-built Envira Dynamic Gallery in the list.

You can edit this Envira Dynamic Gallery to configure the settings of all your dynamic galleries in WordPress.

Edit Dynamic Gallery

It has a similar interface as a normal Envira Gallery. However, you can manage the settings of all your dynamic image galleries from this Envira Dynamic Gallery.

(Check out how to create an image gallery with thumbnails in WordPress for more details on the settings in Envira).

We hope this article has helped you to learn how to automatically create dynamic image galleries in Envira. You may also want to check out our guide on where does WordPress store uploaded images.

If you like this article, then please follow us on Facebook and Twitter for more free WordPress tutorials.

Using WordPress and want to get Envira Gallery free?

Envira Gallery helps photographers create beautiful photo and video galleries in just a few clicks so that they can showcase and sell their work.

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.