I got often asked if it is possible to create an image gallery in WordPress and order the content by filename. Especially photographers faces this feature lack. With the default WordPress gallery (the gallery-shortcode) you have to manually sort the images.
Stop the manual effort and save a lot of time! With our plugin Real Media Library you have the ability to sort images with one click by natural filename (ascending or descending). With Real Media Library you can also benefit from a central gallery management. Just have a look at the following simple and short step-by-step guide below:
You will need to download and install Real Media Library plugin from here.
Create a collection and gallery
First of all create a collection. Select the created collection and create a gallery data folder. To this gallery data folder you can upload your images which you want to order by filename. From the FAQ “What is the difference between folder, collection and gallery?” you can read the differences about the three default folder types which comes out-of-the-box. Note: You can also use a normal folder to apply a order by filename – this has the advantage to also order non-image files by filename.
Folder details and apply order
Open the folder details of the gallery data folder. A dialog will appear and you should find a row with a dropdown and the name “Order”. Here you can select a set of predefined order options. For our use case you have to select the “Natural order by filename ascending” or “Natural order by filename descending“. Then press “Apply”. The view gets refreshed and after you close the dialog you will see your content ordered by filename. Currently (Version 3.2.1) you have to apply the order manually, it is not automatically applied to your folder after you upload a new image.
Publish your gallery to your website
The next step is to publish a gallery to your website which respects the custom order. Navigate to your post or page and you will find a “grid-icon” in your editor. This will allow you to create a Gallery from Media Folder. Simply select the ordered gallery and save the post.
Make your photos shine
If you do not like the theme-default gallery you can use a plugin like Justified Image Grid (you can get here) to show a nice and responsive image gallery. It also allows you to use Real Media Library folder as source and it respects all the settings of Real Media Library (like the custom order).
Author: Matthias Günter
Creative designer and programer from Low-Bavaria. I love to simplify things, especially when it comes to WordPress. If you like, you can take a look at my plugins.