Creating a Photo Gallery in WordPress
Many people get confused when trying to create a photo gallery in WordPress. It isn’t obvious at first glance how to utilize this built-in feature. Let me walk you step-by-step through how to create a photo gallery by uploading images from your computer or by using images already in your media library. Just in case you need a little more help, you can follow along with the video!
Prerequisites to Your Photo Gallery
It is important to understand that before you can create a photo gallery in WordPress, you must first associate at least two images that you want in your gallery with the post or page where it will appear. The best way to do this, is to go to the post or page where you want your photo gallery and click on the ‘Add an Image’ icon at the top of your editing area.
You will be given the option to add an image from your computer, from a URL or from your media gallery. Images added via URL are not actually associated with the post or page, so this method is not an option.
If you want to attach multiple images to your post or page simultaneously, you want to use the ‘Upload From Computer’ option. Attaching images from the media library to your post or page is possible, but not recommended. I will go into more detail on this later.
A search engine optimization (SEO) sidenote: You will want to be sure that the image file names contain relevant keywords before uploading them to WordPress. You will also want to be sure you use descriptive keywords in the “Alternative Text” box for each image.
Once you have uploaded at least two images to your post or page and clicked on the ‘Save all Changes’ button that appears, you will see a ‘Gallery’ tab appear. Click on this tab to configure your gallery settings.
Inserting the Gallery
Once you are on the gallery tab, you will be able to edit any details for the images and select some options for your gallery.
Let me explain the options available when configuring your gallery:
- Link Thumbnails To – The options here are ‘attachment page’ and ‘image file’. This option determines the action that takes place when a user clicks on a thumbnail in your image gallery. If you select ‘image file’, the user will be taken to a page that displays the full size image. If you select ‘attachment page’, users will be taken to a page that uses your website’s theme, displays the photo, and allows them to comment on the photo.
- Order Images By – The options here are ‘menu order’, ‘title’, ‘date/time’, or ‘random’. The menu order option allows you to put the thumbnail images in your gallery in any order you want using the drag and drop feature (or by numbering the images if this feature is not available to you). The title option sorts the images by the image title. The date/time option shows images ordered by the date and time that they were first uploaded. The random option loads the thumbnails in a different order every time the page is loaded, in case you just want to mix things up.
- Order – The options here are ‘ascending’ and ‘descending’ and allow you to reverse any of the previous selected sort orders.
- Gallery Columns – This is fairly self-explanatory, but this option allows you to select how many columns of thumbnail images you have in your photo gallery. In other words, the number of images from left to right in a given row.
Now that you have selected the settings that work for you, go ahead and click the ‘Insert Gallery’ button!
The Media Library Method
NOTE: This is NOT a recommended method!
There are a lot of people who use WordPress’s built-in media library to keep up with their images. Often, people ask how to create a photo gallery using images that already exist in their media library without having to re-upload them. In order to do this, you must associate the images in the media library with the post or page where you want your gallery to appear. There are two ways of doing this:
- Insert the image into your post or page from the media library. This associates the image with your post (or page). Since you are creating an image gallery, you probably don’t want the full size image to appear in addition to the gallery. So you must delete the image from the post after inserting it. Don’t worry… it is still associated with the post and will appear in the gallery.
- From the media library, find the photo you want to associate with a post and click the ‘attach’ link. Search for the post or page by name and then select the appropriate one.
Be aware that there are some limitations and risks associated with using this method:
- Each image in your media library can only be attached to a single post or page.
- The only way to remove an image from a gallery on a particular post or page is to delete it. Deleting the image removes it not only from that particular gallery, but the media library as well. If the image was being used elsewhere, it will no longer be available.
You can always make changes to your gallery settings later by clicking on the gallery placeholder (from the visual editor, as opposed to the HTML editor) and clicking the small icon that appears in the top left corner.
Deleting the gallery is as easy as clicking on the placeholder and hitting delete.