One of the many reasons genealogists like blogging is the ability to show off those great family photos. WordPress lets us show them off in style with a very nice gallery function. In this gallery, you see four photos arranged in two columns. Depending on your theme, you can design galleries with up to four columns and as many images as you’d like. You choose the size and order of the images in your gallery and you choose what your visitor will see when she clicks on an image – just the image or an attachment page for that image.
Anytime you start uploading more than one image in a post, WordPress will assume you are building a gallery. If you aren’t, just insert the images into your text as you always do. If you do want to create a gallery, click on the Gallery tab that magically appears as soon as you add more than one image in a post.
The gallery pane shows each of the images you’ve uploaded at the top of the pane. You can click the Show link to the right of an image to update the metadata (title, alt text, caption, etc.) for it. In the Gallery Settings area, you’ll set the options you want for your gallery. Here I’ve chosen to display my images in an attachment page rather than just the image in the browser. The attachment page displays the image and both the Title and Caption fields as a page using your site’s theme.
Next comes how you want to order the images you display. Your options are menu order (the order they appear in the gallery pane), title, date/time or random – and you can choose ascending or descending order. The last option is the number of columns for your gallery. In my case, 4 columns wouldn’t fit into my theme and 3 would be awkward since I only have 4 image so I chose to use 2 columns. Once everything’s ready, click Insert gallery and you’re done.
If you look at the HTML of your post, all you’ll see is a gallery shortcode - gallery columns=”2″ - showing a columns attribute. Note: the shortcode should be surrounded by square braces ( [ ] ). There are many more options available for the gallery shortcode and these can give you even more flexibility. For example, you’ll notice the gallery below has larger images. The standard shortcode defaults to using the thumbnail size, but you can add a size attribute to select which size you prefer. I used medium here.
Another useful attribute is exclude. By default, the gallery will include every image uploaded in the post. In this case, I don’t want the gallery pane screenshot included in the gallery so I used the exclude attribute to keep it separate. There’s also an include attribute which will let you pull in images from anywhere in your media library.
You’ll find a complete discussion of the gallery shortcode and all its attributes at the Gallery Support page.
Your theme has the most impact on how your gallery is displayed. Older themes may not be as gallery-friendly as more recent ones. Do a bit of experimenting to see how your theme handles galleries. If you don’t like what you see, you might want to start looking for a new theme. As we’ll see in future posts, galleries aren’t the only features that improve with theme support.