How to Create a Dynamic GalleryEnhanced Media Library
Dynamic gallery auto updates itself when you attach new images to a media category or detach them from it.
What’s required?
To make a dynamic gallery we need two things:
- Advanced Editor Tools by Automattic — a plugin that makes the Classic Editor block in Gutenberg block editor more convenient to deal with.
The admin page with the Classic Block and gallery in it before installing this plugin:
The same admin page after activating Advanced Editor Tools:
- Enable
Media Shortcodes
inSettings
⟶Media Library
⟶Media Shortcodes
(section).
How to create a dynamic gallery
Note: For performance it’s better to use IDs instead of slugs in the gallery shortcodes.
Available attributes
In addition to the WP built-in gallery attributes.
media_category
or any other taxonomy namemonthnum
year
limit
of media items to show
Dynamic gallery with EML PRO
Dynamic gallery’s front-end
To style gallery’s front-end use any plugin that works with WordPress native gallery shortcodes like Justified Gallery or Meow Gallery.
Advanced features for the front-end are coming with the future updates of Enhanced Media Library.
Gallery’s front-end in pure Twenty Twenty-Four theme:
Gallery’s front-end with Justified Gallery plugin: