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 Create Gallery link in the left sidebar.
As you see here, four photos are checked, but one is selected. The details panel for that photo appears in the right sidebar. Use this to include captions and alt text information then select the next photo to update it. After clicking the Create Gallery link at the top of the left sidebar, the Insert into post button at the bottom right corner of the panel will change to say Create Gallery. Click on it when you’re ready to proceed.
The Edit Gallery pane shows each of the images you’ve included in your gallery. In the Gallery Settings area, you’ll set the options you want for your gallery using the panel on the right. If you set your images to link to the attachment page, clicking on the published image will display a page containing the image and both the Title and Description 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 photos 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, the standard shortcode defaults to using the thumbnail size, but you can add a size attribute to select which size you prefer.
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.