How to add a gallery in WordPress with a lightbox effect is one of the hottest question that we have been getting lately through our contact form, so we have decided to cover it. Many beginners are not aware that WordPress has a built-in gallery feature that can be used on any post or page. In this article, we will show you how can add the native gallery in a WordPress post or page. We will also show you how to install a plugin that will allow your users to open the full-size images in a lightbox which will keep them from going to a different page.
Adding a WordPress Gallery
First open an existing post/page, or create a new post. Next thing you need to do is upload a bunch of images to this post. Click the Upload Media icon to upload your new Gallery images.
Once you have uploaded all the images, make sure you come to the Gallery Tab. Scroll down until you see the Gallery Settings. Choose your ordering scheme, and decide how many columns you want your gallery to have. on this page. A good rule of thumb is to use 3 on 3 column layouts, 4 on 2 column layouts, and 6 on full width layouts, but it can vary depending on the theme you have. Once you have selected the settings, Click Insert gallery.
Now, you will see a new icon that is added to the body of your post which represents the gallery.
Just click Update or Publish on your post/page, and the gallery will be added to the live site.
Adding Lightbox to the Native WordPress Gallery
If you try to click any of the thumbnails in your new gallery, you’ll notice they just open up a separate attachment page in a new window which is not very user-friendly. But, you also want to give the users to view the full-size images which is why we will install a simple plugin called jQuery Lightbox For Native Galleries.
First, Install and Activate the Plugin.
Next, you need to go to Settings » jQuery Lightbox. Select the theme you want to use for your lightbox window.
Now come to your post, and test your gallery. It should be working fine.
Congratulations, you have now added a gallery with a lightbox to your WordPress post or page. Final preview would look something like this:
FAQ from the Comments
- Binoy in the comments asked that if there was a way to select which image shows up in the gallery because by default all images attached to the post are added. Leo was kind enough to share the plugin Multiple Galleries which adds checkboxes next to images you have uploaded to a gallery in a post. Selecting checkboxes will include those images in that particular gallery.