If you want to add image galleries to your WordPress pages or posts, you can use the ‘[ gallery ]’ shortcode. There are also numerous plugins that offer a tremendous amount of functionality and are easier to use; we will mention them at the end of this post. For those who are adventurous, though, let us continue with our discussion of the usage of the ‘[ gallery ]’ shortcode and its options.
The first thing to know is that there are two versions of the shortcode. The earliest version is the simplest form; it was the default shortcode through until WP 3.5. According to the official WordPress documentation, the syntax was very simple. You could insert a gallery of images by coding something that looked like:
[ gallery option1="value1" option2="value2" ]
The downside of this simple shortcode is that it limited image galleries to only those images that were loaded into the page or post by default. That sort of defeated the purpose of having a gallery, so WordPress developers had to rework the code to allow users to pull in other images.
The Current Code
The current code expands on the original by allowing for additional options. For example, you can now use the code to:
- pull in images that are not loaded by default
- determine options for displaying thumbnails, including sort order and size
- specify the number of columns to include in your gallery
- assign unique ID numbers to your images
- set unique tags including item name, display icon, and caption
- specify any links you want to be attached to your images
- include or exclude images by ID number using comma separated values.
As the new ‘[ gallery ]’ shortcode has so many options, it would be impossible to explain in such a short space how to use it. Therefore, we recommend you consult the official WordPress documentation for more details. The documentation lays out precisely how to generate proper syntax to create the kind of gallery you want.
The availability of so many great plugins for WordPress image galleries makes it possible to create a beautiful layout of your images without having to know the ‘[ gallery ]’ shortcode. Among the most popular plugins are:
- Photo Gallery (webdorado) – With 300,000+ active installs, this one is right at the top of the list. Photo Gallery is an advanced plugin with dozens of different options for a high level of customization. It is also fully responsive.
- Gallery Bank (Gallery-Bank) – This plugin boasts 30,000+ active installs. It is capable of generating standard image galleries along with video and image albums that make organization as easy as can be.
- Gallery-Image (Huge-IT) – Gallery-Image is a responsive WordPress gallery with different choices for views. Its aim is to help you create something original that doesn’t look or act like anything else. Gallery-Image boasts 70,000+ active installs.
Your options for adding image galleries to your WordPress site are numerous. You can use the ‘[ gallery ]’ shortcode or one of the many quality plugins.