Beginner's Guide for WordPress / Start your WordPress Blog in minutes

How to Create an Image Gallery in WordPress (Step by Step)

Are you looking to create an image gallery in WordPress?

An image gallery lets you add photos in rows and columns. This allows you to display more photos in less space while also making it easier for users to browse them.

In this article, we will show you how to easily create an image gallery in WordPress that makes your photos look even better.

How to create an image gallery in WordPress

Why Create an Image Gallery in WordPress?

WordPress makes it super easy to add an image to your blog posts and pages. You just need to add the image block and upload your image.

However, if you are adding multiple images, then all those images will appear one after another. It doesn’t look great, and your users will have to scroll a lot to view them all.

Adding Multiple Images in WordPress Post Without Creating a Gallery

By creating a gallery, you can display images in a grid layout with columns and rows. You can show thumbnails for your pictures, and users can click on them to see the full image.

This way, you will be able to show more photos in less space, and it will look a lot more professional.

Preview of WordPress Photo Gallery Using Default Gallery Block

WordPress actually comes with a built-in gallery feature for quickly creating photo galleries. The new WordPress block editor includes a Gallery block to let you make a WordPress gallery in just a few clicks.

You can also use WordPress image gallery plugins to create even more robust galleries with more features.

In this tutorial, we will show you both methods to make a photo gallery in WordPress.

Let’s start with the default WordPress gallery block.

Video Tutorial

Subscribe to WPBeginner

If you don’t like the video or need more instructions, then continue reading.

Method 1. Create an Image Gallery without a Plugin

WordPress comes with a built-in feature that lets you create a gallery. This feature is very basic and does not have many options, but it gets the job done.

Here is how you would create an image gallery in WordPress without using a plugin.

First, you need to edit the post or page where you want to add the image gallery. On the post edit screen, click on the Add New Block icon and select the Gallery block.

Add Gallery Block to WordPress Post Editor

This will add the Gallery block to your WordPress editor where you can click on the ‘Upload’ button to upload photos from your computer. You can also select from previously uploaded photos in the media library.

Image Upload Options in WordPress Gallery Block

If you click on the Upload button, then you can generally upload one photo at a time. However, you can select and open multiple images with Ctrl key pressed on your keyboard.

Upload Images to Your WordPress Photo Gallery from Computer

After you have uploaded all the images, you can add captions to your images. Simply click on the photos, and you will see ‘Write caption…’ option where you need to enter the caption.

Write Captions in Your Gallery Images

If you select the Media Library button, then you will be able to choose images for your gallery all at once. As you select images, you can also enter the image alt text, title, and caption from the attachment details panel on the right side.

Select Images from WordPress Media Library

Select the images you want to add and click on the ‘Create a new gallery’ button at the bottom right corner.

Next, you will see ‘Edit Gallery’ page where you can add/review your image captions. Once done, click on the ‘Update Gallery’ button at the bottom right corner.

Update Your WordPress Library

After that, your post edit screen will open with the gallery block settings panel on the right side. Now, you can choose the number of columns for each row, enable or disable the Crop images option, and choose where to link your gallery images.

WordPress Gallery Block Settings

From the Link to options, you can choose None if you want your users to only view your photo. This option disables clicking feature for your images.

If you select the Media File option, then the images will be clickable, and the image file will open when clicked. Similarly, the attachment page will open if you select the Attachment Page option.

Once you are satisfied with the settings, you can publish the post and preview the gallery on your live website.

For example, here is how the image gallery appeared on our demo website.

Preview of WordPress Photo Gallery Using Default Gallery Block

Wasn’t that quick and easy?

It looks pretty too. However, if you create image galleries regularly, then you will soon notice that it lacks certain essential features.

For example, your images will either be not clickable or open in a new page. If you link your gallery images to the media file or attachment page, then the users will have to click on the back button to view the gallery again.

It is not user-friendly, and your gallery’s appearance depends on your theme. In most cases, you get just one very generic style.

You can’t organize your galleries into topics, albums, tags, etc. Your gallery is not stored anywhere and if you needed to add the same gallery again, then you’ll have to recreate it.

If you want to add more professional looking image galleries on your site, then you should use the next method.

Method 2. Create an Image Gallery Using Envira Gallery

For this method, we will be using the Envira Gallery plugin. It is the best WordPress image gallery plugin in the market.

Envira allows you to easily create fully-responsive, beautiful, and modern image galleries in WordPress. It is super fast and comes with many features like lightbox popup, easy image navigation, drag and drop builder, and professional gallery templates.

Let’s get started.

First thing you need to do is install and activate the Envira Gallery plugin. For more details, see our step by step guide on how to install a WordPress plugin.

Upon activation, you need to visit the Envira Gallery » Settings page to enter your license key. You can get this key from your account on the Envira Gallery website.

Enter Envira Gallery License Key

After verifying your license key, you can head over to Envira Gallery » Add New page to create your first gallery.

Creating a New Gallery with Envira Gallery WordPress Plugin

First, you need to provide a title for your gallery and then click on ‘Select files from computer’ button to upload your images.

You can also select files from your WordPress media library by clicking on ‘Select files from other sources’ button.

Once you upload the images, they will appear in the Gallery section.

Images in Envira Gallery Builder

You can click the pencil icon on an image to add caption, title, and alt text for each image.

Edit Gallery Image Metadata

Next, you need to click on the ‘Configuration’ tab.

From here you can change your gallery settings like the number of columns, image lazy loading, title and caption positioning, margins, heights, thumbnail sizes, image dimensions, etc.

Configure Envira Gallery Settings

After that, you need to click on the ‘Lightbox’ tab.

The lightbox popup allows users to enlarge images and browse them without ever leaving the page.

The default settings will work very well for most websites, but you can review the options and change them if you like.

Envira Gallery Lightbox Options

Next, you can click on the ‘Mobile’ tab to configure your gallery settings for mobile devices. It allows you to choose image dimensions for mobile devices, enable or disable lightbox, and more.

Envira Mobile Gallery Settings

After that, you can review more options like gallery slug and add custom CSS from the ‘Misc’ section.

You can now publish your gallery which will make it available to be added anywhere on your WordPress site.

Next, you need to edit a post or page where you want to display your gallery.

On the post edit screen, click on the Add New Block icon and select the Envira Gallery block.

Add Envira Block to WordPress Post Editor

Clicking on it will add the Envira Gallery block in the post editor. Now you can search a gallery by its name or find it by clicking on the dropdown arrow icon.

Choose an Envira Gallery to Add to your WordPress Post

After that, the plugin will load your gallery in the post editor.

Envira Gallery Added to WordPress Post Editor

Next, you can review your gallery settings one more time from the block settings panel on the right side.

Envira Gallery Block Settings

You can now save your post and preview it to see the gallery on your live website.

WordPress Photo Gallery Created with Envira Gallery

Clicking on any image in the gallery will open it in the lightbox popup. You can browse images in the lightbox by pressing the left and right arrow keys on the screen or on your keyboard.

Envira Gallery Image in the Lightbox Popup

Your gallery will look equally great on mobile as well. Users will be able to tap on an image to enlarge it and swipe to view the next or previous image.

Responsive WordPress Photo Gallery

We hope this article helped you learn how to create an image gallery in WordPress. You may also want to see our guide on how to fix common image issues in WordPress.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit – a collection of WordPress related products and resources that every professional should have!

Reader Interactions

146 CommentsLeave a Reply

  1. Hi I’m a wordpress beginner! My gallery is somehow linked to the homepage…so when clicked the image takes you back to the ‘Home page’ and not to either a lightbox effect or to the image itself. How do I fix this? Catrin

  2. I have a question. I use JQuery plugin for and hovering pin it button. I was wondering if you know of a solution when you click on the photo gallery for carousel mode there is no pin it button. I would I be able to add that button to the gallery?

  3. When someone is viewing my gallery of images with minimal captions, when they click on an image, I would like them to see a larger image with additional information about the image beside or below that large image. I don’t want a gallery of images with all of that information destroying the grid aesthetic. Is this possible? I do not know coding or website jargon – sorry.

  4. I just have to say, this post is awesome… as all your posts are. You have made me into a better programmer. Thank you for all you do.

  5. Hi guys
    Just created my first WordPress gallery and carousel – looks fantastic.

    Just one question, how do I edit the gallery when I work in html mode not visual mode.
    Messed about for half an hour and I can’t figure it out!

  6. Thank you SO much for this post. Not only did you save me HOURS of time creating my client’s gallery, you also taught me something new – and I love a good challenge. Your instructions were clear, concise and accurate. You are appreciated!!!

  7. Hi, sayed will it increase the loading time of website ? Beacause i want ot add around 100 photos to my website

  8. This made things so much easier than using a plugin, thanks so much for the article!
    I have a question though: is it possible to get rid of the image titles under the images and only show them in the lightbox view? I would like to see only images on the gallery page.
    Many thanks,
    Rita

  9. Thank you so much! You make wordpress very easy for beginners like me. I just have one question:

    I have installed the carousel plugin but I don’t want the “write a comment” area to appear. Is there a way to remove it?

    Thanks again!

  10. Thanks so much for this page – it was definitely helpful. I did have one question: I’m working on a photography website and trying to apply a gallery to a page; however, I don’t seem to have the option of using the scroller format when I do that, only thumbnails. I’m using PhotoPro, which allows me to have a scroller on the homepage, but my client really wants that format (with different photos) on several pages, and carousel isn’t much of a substitute for the scroller. I’ve tried to find information about this through several sources, but I can’t seem to find a solid answer as to whether or not it’s possible.

  11. Thanks for this info! I have a couple of questions about the gallery that maybe you can help with.
    1) When adding photos, there is an option that I’m unsure about. What is the difference between link to “attachment page or link to “media file”
    2) Sometimes my photos get “cut off” in the gallery but are “full size” when you go the hyperlinked page or if you click on that particular photo. I have changed the settings so the media size is the same as what I’m resizing them to, but that didn’t help. What else can I do?
    Thanks for any help.
    Marci

    • 1. You can choose to link an image to an attachment page, which is a WordPress page with the image displayed in large size, or you can link to media file, which is the actual image file you uploaded.

      2. It looks like cropping is turned on for thumbnail sizes in your WordPress theme. You can turn off cropping to allow WordPress to scale images when resizing them instead of cropping. The problem with this approach is that your images may look disproportionate.

      update_option(“thumbnail_crop”, “0”);

      Admin

  12. God bless you, folks. Sometimes things are so easy in WordPress. Yet, I miss it. Your site is certainly my first ‘go-to’ site for any wordpress related help.

  13. Kudos!! Simple solution for any beginner. Much easier approach that the various lightbox plugin implementations.

  14. The images does not show up in IE. Is it a known problem?
    Tested IE10 on win7 and win8, same problem.
    Great article!

  15. Awesome !
    A question:
    Is it possibile link a gallery ?
    For example:
    PhotoGallery

    Is it possibile ? How ?

    Thanks and excuse me for my bad english

    • Yes it is possible. Lets say you create a post or a page with a photo gallery in it and you title that page PhotoGallery. It is like any other WordPress post or page and can be linked any where.

      Admin

  16. Awesome! so easy! I’ve spent hours…. trying to get a plugin to do this and it was right under my nose all the time!!!! thank youuuuuuuuuuuu

  17. Thank you for explaining this so clearly! I really wish I would have found your site 3 days ago…make that 3 years ago.

  18. Hi, is there a way to reduce the opacity of the image border? or to remove completely? Thanks

  19. Thanks for a great tutorial. I’m wanting to have my gallery on one side of the page and have it open the album in a carousel next to it in another div. How difficult would that be to do?

    Thanks,
    Keith

  20. Hello and thank you for posting this! Do you have any idea why, when clicking on the photos to view them, they are as small as the thumbnails? Thank you!

  21. Hi, how come when i change the thumbnail size under Settings > Media, the previously uploaded images with old thumbnail size doesn’t change into the new size? Does this mean i have to re-upload those images?

  22. Great article, thanks!

    Is it possible to keep the captions displayed on the page, instead of only displaying if the user clicks to display the larger img?

    Many thanks

  23. Can i add this feature on my website without installing the plugin. I mean can i add it manually in theme files?

  24. Hi there, When I click on a thumbnail of a gallery in my post, it pulls up the gallery carousel but it is off to one side of my screen, like 2 inches on the left so the photos look scrunched up. Do I have something off on my settings?

  25. The plugin is particularly good as it’s responsive, I’ll use it on my sites.
    I’m currently using a premium plugin that adds social share buttons to the image in a lightbox. It’s pretty good.
    One question: if you use the plugin and comment to a photo where the comments shows up? Is like a comment to the article?

    • Zimbrul – Which plugin are you using to add social share buttons to the image in lightbox? Do you have an example you can share? I’m looking for this for a project I’m currently working on.

      Thanks,
      Keith

  26. Hi!
    When I’m using the Visual Editor I can’t see the box in post edit area indicating that there is gallery code.It used to be there, but something is changed!
    Need to know how to fix this!
    Sanna

      • Thanks for the reply!
        If I have added a plugin am I not aware of that I did. How can I check if there is any plugin that I should remove??
        / Savannah

  27. Great post! I’ve just been having fun choosing which great gallery mode to have on my blog – the ‘Circles’ option is stunning!! Really professional looking. I had no idea WP had this.

    Thanks for posting this HowTo! ;)))))))))))))

  28. Hello! I THINK this post might be able to help me, but at this point in the day, I am feeling pretty dumb, so… who knows? I have been trying to install a simple slideshow on my WordPress.com blog all afternoon. Literally for the past 5 hours. I have read 8 million supporting pieces, but every time I preview it, I see small thumbnails that open to slightly larger images. If I click on THOSE images, they open into large, individual pictures. I know there is a way to just go straight to large images. I just cannot figure it out. Please, someone, help!

    thanks so much in advance.

  29. Thank you for this post. I had no idea WordPress even had this fetaure and I’ve been using it for years. I was using the NextGen Galley but this is perfect for a small project I’m working on. Very helpful.

  30. Hi, When using the Carousel without Jetpack plugin (which works very well, thank you for that!) can you have just one large image on your webpage, which when clicked, opens the carousel gallery as it does in Facebook? I want my webpage to not be a gallery of all the pictures, but rather one image larger.
    Any thoughts?
    Thanks!

  31. Hi, I wonder what to do about the empty tags being created before and after the gallery. Can you help me out with this?

    Kind regards,

    Willem

  32. Hey,
    I followed your instructions for a site I’m working on but it doesn’t seem to work.
    The images are not displayed in a carousel even though the plugin is installed and activated.

    Any ideas please?

    • It is possible that you have another plugin activated that is conflicting with the carousel plugin. Can you please send us an email with your site url, so we can take a look.

      Admin

  33. Thank you so much for this! I just made a gallery, it is going to be a visual recipe index for my food blog. Is there a way to add a link to the recipe, when the picture is clicked?

  34. Thank you for this! I was looking for a plugin to make a gallery, I didn’t know you could do this on wordpress directly, I just made a gallery for an article and it looks really good! <3

Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.