How to Add a Lightbox Image Gallery to Posts and Pages in WordPress

For distraction-free online image viewing, the Lightbox JavaScript library is hard to beat. Lightbox displays an image gallery on a webpage and puts a dark overlay on top of the rest of the page’s content. Using Lightbox, it is easy to create attractive image galleries that maintain a high level of user engagement.

Although WordPress has built-in image management functions that allow you to embed galleries in posts and pages, the galleries that WordPress creates tend to lack visual appeal. WordPress also doesn’t have built-in Lightbox support. To add a Lightbox gallery to a post or page, you’ll need to use a plugin.

Why Use a Lightbox Gallery in WordPress?

The primary reason for using a Lightbox gallery in WordPress is because it can make your website’s images look more attractive. WordPress’s built-in image galleries give you no room for customization. You might like the way your website’s theme renders posts and pages. If you don’t like the way it renders image galleries, though, you’ll need to modify the theme’s CSS style sheet — or install a plugin.

A Lightbox image gallery may also have features that WordPress lacks. A Lightbox plugin may allow you to create galleries that mix image and video content, for example. Some plugins may support touch controls for navigation. Many have multiple skins that you can use to change the appearance of your galleries.

The Lightbox library also has a more practical purpose in that it keeps the user on the current page. WordPress creates an attachment page for each image that you upload. If a user clicks an image to view a larger version, he’ll navigate to the image’s attachment page — and away from the article containing the image. Lightbox is a more elegant solution that displays a zoomed image without forcing the user to navigate away from the page.

Our Favorite Lightbox Gallery Plugins


Link ($21)

iLightbox works with all browsers and features full mobile device compatibility including support for touch navigation. Many have praised the plugin’s fast loading speed.

Lightbox Evolution

Link ($21)

Lightbox Evolution provides an easy way to add Lightbox galleries to any post or page on your website. It includes 10 skins for customizing the appearance of your galleries.

How to Add a Lightbox Gallery in WordPress

With the large number of Lightbox gallery plugins available for WordPress, providing one set of instructions that works with all plugins is impossible. However, we can provide a set of general instructions that will provide a starting point for most Lightbox gallery plugins.

  1. Open the “Plugins” menu in WordPress. Select “Add New.” If you purchased a premium plugin such as the ones mentioned above, click the “Upload Plugin” button to upload the plugin file from your computer. To search the WordPress repository for a free plugin, type “Lightbox” in the search field at the top of the page to look for an option. When you install the plugin, you’ll see a new menu option such as “Lightbox Gallery” appear on the left side of the page.
  2. Open the new menu to see the interface for your Lightbox plugin. Locate and click a button such as “New Gallery.”
  3. Upload images for the gallery from your computer. Most Lightbox plugins should also allow you to select existing images from the WordPress media library.
  4. Save the gallery after you finish selecting or uploading images. The gallery plugin will provide a shortcode. A shortcode is a term in brackets — such as “[gallery1]” — that functions as a reference to a larger block of code elsewhere on your web server.
  5. Type or paste the shortcode — including the brackets — in any post or page where you would like the Lightbox gallery to appear.