WordPress Image Gallery

Building WordPress image galleries is a rather painless process and allows you to display a set of photos/images to your users inside posts/pages related to an event or topic.

In case you are interested in seeing what the result looks like, you may want to look at the Kgaswane Nature Reserve post I wrote on the Rustenburg website I built for my town/city. It has a set of photos in a WordPress post in a gallery format. Beautiful, isn’t it? Yes, the nature reserve is beautiful as well!

What You Need

Before we get started, there are two WordPress plugins which you are going to need. Neither of them are specifically required but I recommend them since they integrate very well and will provide your users with a more pleasant browsing experience and also gives you the flexibility that you need.

The first plugin was developed by myself personally. I released it on the Tribulant Software website and it requires a license. It integrates the Lightbox JavaScript library into WordPress and gives you the ability to display images in an overlay on the same page.

The second plugin is a free, GPL based plugin which was developed by Peggy & Justin Hawkwood. The Gallery Plus plugin simply adds configuration values for the WordPress “gallery” shortcode in the “Settings” section of your WordPress dashboard.

Upload both of these plugins to your “wp-content/plugins/” folder after downloading and extracting them. With the plugins uploaded, go to your “Plugins” section in your WordPress dashboard and activate them. By activating these plugins, they are ready for use and you can configure them according to your needs in the “Settings” section of WordPress.

In order for the WordPress Lightbox plugin overlay effects to be used when you insert the WordPress gallery shortcode, you need to change a configuration value in the Gallery Plus plugin. Go to “Settings” > “Gallery Plus” in your WordPress dashboard and change the “rel value in tag” setting to “lightbox”.

Building a WordPress Image Gallery

Before you can insert an image gallery into a WordPress post, page or theme, you’ll need to upload/attach some photos/images to a WordPress post or page. You can do this by writing a new post or editing an existent post and make use of the media uploader integrated into the WYSYWIG editor of WordPress to upload your images.

IMPORTANT : Replace the curly brackets in the codes below with block brackets. In other words, “{” becomes “[" and "}" becomes "]“. Otherwise it will not work.

With a few images uploaded to a post/page, you can insert the following code directly into the content of the post/page where you want the WordPress image gallery to appear.


This WordPress gallery shortcode will be replaced with thumbnails of all the images you uploaded to the specified post/page using the media uploader mentioned above.

If you prefer to insert an image gallery into a WordPress theme, you can do so by inserting code like below into your WordPress theme files.

There are several options you can specify when executing the WordPress gallery shortcode. For example, when hardcoding the image gallery directly into your WordPress theme, you’ll need to specify an “id” attribute to tell WordPress which post/page’s images you would like to show.