Skip to Content

WordPress Feature: Gallery

A gallery is a great way to show several images all together at once and the best part is when the user clicks on one of the images it will use lightbox (show larger images/videos will fill the screen and dim out the rest of the web page, sort of like a pop up window only better) to show larger images. How cool is that? Here’s an example:

Well I’m sure you will get comfortable with how to insert an image on your blog post or page (Add Media feature). In case if you are not, you can learn more on OIT’s WordPress DIY Guide: Working with images and video and get experience with it before you go a step further with using the gallery feature.

Adding a Gallery

New gallery block
Figure 1. New gallery block.
Create Gallery screen, with some images selected
Figure 2. Create Gallery screen, with some images selected.
  1. Insert a Gallery Block. On the gallery block, you can either upload a batch of images with the Upload button or select files from the Media Library (figure 1). In this case, we will select Media Library.
  2. Choose your images from the “Create Gallery” screen (figure 2).
    • You can select images already uploaded to your gallery, or you can upload new ones.
    • Make sure that the Title field is filled out with something that makes sense for your image, and not random letters and numbers generated by your camera.
    • If you leave Alt Text empty, WordPress will automatically use the image Title for your image’s alt text. Alt text must be provided for accessibility compliance, so make sure either the Title or Alt Text field are filled out with an accurate and concise description of your image.
  3. Once you are good with your selection of images, click the Create a new gallery button.
  4. On the next screen, you will be able to drag and drop the images to organize them. Pretty neat, and if you notice “Caption this image…” written under individual images this will allow you to type a caption if you haven’t typed caption already.
  5. Once you have your images arranged and captioned, click the Insert Gallery button

Gallery Settings

The Gallery Settings are located on the right side of the page when the gallery block is selected (figure 3).

Gallery settings
Figure 3. Gallery settings.
  • Link to: Select “Media File” from the dropdown to make images appear in a lightbox overlay when the thumbnails are clicked. Make sure that “Media File” is selected and not “Attachment Page”. “Attachment Page” will take your visitors to a new page each time they select an image, which is not the best experience.
  • Columns: The number of columns your thumbnails will display in. I would suggest between 3-4 columns so it will look good on mobile view.

Caption Placement

Captions will show as text inside the image thumbnails by default. If you want to have the captions appear under the images:

  1. Click on of the images in the gallery to see the Gallery Settings on the right
  2. Scroll down to “Advanced” in the settings, you may need to expand it to see the options
  3. In the Additional CSS class(es) field, add: captionunderimg
  4. Add “captionunderimg” in the “Additional CSS class(es)” field (figure 4).
Screenshot of Advanced panel where you need to add "captionunderimg"
Figure 4. Adding caption under image CSS class to gallery.

Here’s the resulting gallery, with captions under the thumbnails. Compare it with the gallery at the top of this article: