Sorting the Divi Gallery Module Images

This post may contain referral links which may earn a commission for this site

The Divi Theme's gallery module lets you display a grid of images in your posts. Here's how to control the order in which the images appear.

Set the Default Order in the Divi Gallery Settings

By default Divi will display the images in the order that they are added to the gallery. This might be enough for you to get the order you wish. You can just add the images one at a time to the gallery in the order you want them to display. Note that you can add multiple images at once and they will be added to the gallery in the order they appear in the media library – i.e. the most recently uploaded image will appear earliest in the gallery.

Sorting the Gallery Image Modules by Drag and Drop

The Divi gallery module has a handy, though not very obvious, feature for re-ordering the images in the gallery module. You can simply drag and drop them into the order you wish them to display, like so:

Displaying the Gallery Module Images in a Random Order

To have the gallery images shown in a random order each time the page is displayed, you can simply set the following Divi option:

Gallery Settings > Content > Images > Image Order = Random

Displaying the Gallery Module Images Alphabetically

If you'd like to have the images in your gallery modules automatically sorted alphabetically, by the title set in the media library, you can use the following PHP code:

Sorting the Gallery Module Images by Filename

If you wish to sort your images by filename, this Stack Overflow post offers some options.

Hundreds of new features for Divi
in one easy-to-use plugin


Submit a Comment

Your email address will not be published. Required fields are marked *