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.
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 to your WordPress website, 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.
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.
For example, if you are creating a photography website to display your images, then adding a photo gallery allows you to display your work in an aesthetically pleasing way.
With WordPress, you can easily create an image gallery using the Gallery block in the Gutenberg block editor.
You can also use WordPress gallery plugins to create even better galleries with more features.
Having said that, let’s see how to easily create an image gallery in WordPress.
For this tutorial, we will be showing two methods to create a gallery, and you can use the links below to jump to the method of your choice:
Method 1: Create an Image Gallery With WordPress Block Editor
If you want to create an image gallery using the WordPress block editor, then this method is for you. However, keep in mind that this feature is very basic and does not have many options.
First, you need to open an existing or new post/page where you want to create the gallery from the WordPress admin sidebar.
Once you are there, just click the ‘+’ button in the top left corner of the screen. From here, find and add the Gallery block to the page or post.
Once you have done that, click the ‘Upload’ button to upload new image files from your computer.
However, if you want to upload images from the media library, then you must click the ‘Media Library’ button instead.
If you click on the ‘Upload’ button, then you can generally upload one photo from the computer at a time.
However, you can select and open multiple images with the Ctrl key held down on your keyboard.
After you have uploaded all the images, you can add captions to them by clicking on the ‘Add Caption’ icon in the block toolbar at the top of individual images.
You can also add alt text to the images from the block panel on the right.
If you select the ‘Media Library’ button, then you will be able to choose multiple 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.
Once you have added all the images, simply click the ‘Create a new gallery’ button.
This will direct you to the ‘Edit Gallery’ page in the media library prompt.
From here, you can select individual images and add a caption, title, description, or alt text to them.
Once you are done, simply click the ‘Insert Gallery’ button at the bottom right corner.
The image gallery you created will now be added to the WordPress editor.
You can also further customize it by selecting the Gallery block and configuring its settings from the block panel on the right.
For example, you can use the ‘Columns’ slider to decide the number of columns and rows for your galleries.
You can even toggle the ‘Crop Image’ switch to crop the thumbnails for better alignment.
From the ‘Link to’ options, you can choose None if you want your users to only view your photo. This option disables the clicking feature for your images.
However, 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 happy with the settings, click the ‘Publish’ or ‘Update’ button at the top to store your settings.
Finally, you can visit your WordPress blog to see the image gallery in action.
You have now easily created an image gallery for your website. However, you will soon notice that it lacks some essential features.
For example, your images will either be not clickable or open on 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.
This is not user-friendly and can discourage users from further exploring your website.
Similarly, the gallery’s appearance also depends on the WordPress theme that you are using.
Plus, you can’t organize your galleries into albums, topics, tags, and more. Your gallery is not stored anywhere, and if you need to add the same gallery again, then you will have to recreate it.
If you want to add more professional-looking image galleries to your site, then you should use the next method.
Method 2: Create an Image Gallery Using Envira Gallery (Recommended)
If you want to create a more functional and aesthetically pleasing image gallery for your WordPress site, then this method is for you.
We will be using the Envira Gallery plugin as it is the best WordPress image gallery plugin on 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 a lightbox popup, easy image navigation, a drag-and-drop builder, and professional gallery templates.
First, you need to 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, head over to the Envira Gallery » Settings page from the WordPress dashboard to enter your license key.
You can get this key from your account on the Envira Gallery website.
Note: Envira Gallery also has a free plugin that you can use. However, we will be using the pro version for this tutorial to unlock more features.
After verifying your license key, you can head over to the Envira Gallery » Add New page from the WordPress sidebar to start creating your first gallery.
Once you are there, provide a title for your gallery and then click on the ‘Select files from computer’ button to upload your images.
You can also upload images from your WordPress media library by clicking on the ‘Select files from other sources’ button.
Keep in mind that if you use this option, then you can only upload a single image at a time from the media library.
Upon uploading the images, scroll down to the ‘Gallery’ section, where all your photos will now appear.
Next, you can click on the pencil icon at the top of each image to open the ‘Edit Metadata’ prompt on the screen.
From here, you will be able to add the caption, status, title, and alternative text for individual images.
Once you are done, don’t forget to click the ‘Save Metadata’ button to save your image captions.
Next, you need to click on the ‘Configuration’ tab from the sidebar on the left.
From here, you can change your gallery layout, including the number of columns, image lazy loading, image size, title and caption positioning, margins, heights, thumbnail sizes, image dimensions, and more.
After that, switch to the ‘Lightbox’ tab from the left sidebar and check the ‘Enable Lightbox’ option.
This option will now allow users to enlarge images and browse them without ever leaving the page.
You can leave the other default settings as they are because they work very well for most websites, but you can review the options and change them if you like.
Next, click on the ‘Mobile’ tab to configure your gallery settings for mobile devices.
From here, you can choose image dimensions for mobile devices, enable or disable Lightbox, enable/disable image captions, and more.
After that, you can review more options like gallery slug and adding custom CSS from the ‘Misc’ section.
Once you are happy with your settings, just click the ‘Publish’ button at the top to store your changes.
Next, you need to open up a post or page where you want to embed your gallery.
Once you are there, click the ‘+’ button in the top left corner of the screen to open the block menu.
Next, simply find and add the Envira Gallery block to the page or post.
Once you have done that, you need to add your image gallery from the dropdown menu in the Envira Gallery block.
Finally, click the ‘Update’ or’ Publish’ button at the top to save your changes.
Now, you can view your image gallery on your WordPress website.
Here, you will notice that clicking on any image in the gallery will open it in full size with the lightbox effect.
You can also browse images in this popup by pressing the left and right arrow keys on the screen or your keyboard.
Bonus: Optimize Gallery Images For Search Engines
It is important to optimize all your gallery images without losing web quality so that search engines can index them for the right keywords.
This can help boost your page loading speed, improve user experience, enhance social media shares, and bring organic traffic to your website.
You can easily optimize your gallery images by always adding alt text for them in the attachment details page. This description is shown to the search engine crawlers and helps your image galleries rank higher.
Additionally, you can also use All in One SEO, which is the best WordPress SEO plugin on the market.
It comes with an Image SEO addon that will automatically set your alt text, image titles, captions, and more. It will also add a proper image sitemap and other SEO features to improve your SEO ranking.
For more information, see our AIOSEO review.
Other than that, you should also use descriptive file names for your images, use relevant keywords, and share your galleries on social media. For more tips, see our beginner’s guide on how to optimize images for search engines.
We hope this article helped you learn how to create an image gallery in WordPress. You may also want to see our comparison between WebP vs. PNG vs. JPEG: the best image format for WordPress and our expert picks of the best WordPress plugins for managing images.
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.
Syed Balkhi says
Hey WPBeginner readers,
Did you know you can win exciting prizes by commenting on WPBeginner?
Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
You can get more details about the contest from here.
Start sharing your thoughts below to stand a chance to win!
WPBeginner Staff says
Are you using any other plugins that might cause conflict? Try deactivating all plugins and see if this fixes the problem.
Catrin Siân Lloyd says
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
Michele says
Hi, is it possible to add a lightbox gallery like this in a widget area? Thanks-
Michele
Tyler says
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?
Diane Lara says
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.
Imagine That says
This post is so helpful! Many Thanks
Sabrina says
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.
Keith Davis says
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!
Christy says
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!!!
Kailash says
Hi, sayed will it increase the loading time of website ? Beacause i want ot add around 100 photos to my website
WPBeginner Support says
Yes, though it is probably not a good idea to add 100 images even if they are thumbnails, on a single page or post.
Admin
Rita says
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
Ana Mota says
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!
James McInally says
Never knew about the carousel plugin for the WP Gallery, so cheers for that, J
Courtney says
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.
vaisakh says
tnkz for your post…..it really helped me…
Gale Weithers says
This post was very very helpful! Thanks a mil!
Marci Hess says
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
WPBeginner Support says
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
Krish Murali Eswar says
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.
Robert says
Kudos!! Simple solution for any beginner. Much easier approach that the various lightbox plugin implementations.
Peter says
The images does not show up in IE. Is it a known problem?
Tested IE10 on win7 and win8, same problem.
Great article!
WPBeginner Support says
We are not aware of any such issue. We were unable to reproduce it in internet explorer.
Admin
Dave Lampen says
Is it possible to get rid of the comment box under the gallery?
Francesco says
Awesome !
A question:
Is it possibile link a gallery ?
For example:
PhotoGallery
Is it possibile ? How ?
Thanks and excuse me for my bad english
WPBeginner Support says
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
Karen says
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
Marie says
Thank you for explaining this so clearly! I really wish I would have found your site 3 days ago…make that 3 years ago.
Santhi Wijaya says
Hi, is there a way to reduce the opacity of the image border? or to remove completely? Thanks
WPBeginner Support says
Santhi you can override the default gallery CSS in your style sheet
Admin
Keith says
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
alex says
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!
WPBeginner Support says
One possible could be thumbnail issue with your theme. Try regenerating thumbnails and then create a new post with gallery to see if this resolves your issue
Admin
Lyman says
This is awesome. Exactly what I needed! Thanks for creating it.
Santhi says
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?
WPBeginner Support says
We have a tutorial on how to add new image sizes in WordPress. Also take a look at how to regenerate thumbnails and new image sizes.
Admin
rachael knight says
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
Annei says
Can i add this feature on my website without installing the plugin. I mean can i add it manually in theme files?
Editorial Staff says
There is no plugin for this. This is a built-in feature in WordPress.
Admin
Kristen says
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?
Daniel says
Thanks!
Zimbrul says
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?
Keith says
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
Abhijith V M says
Nice information there. Thanks
Carlin says
Good stuff…better than WP’s support pages!
Savannah says
I send you this link to my site-URL.. Will you PLEASE check my galleries?
http://savannahz.wordpress.com/
Savannahz
Editorial Staff says
We don’t provide support for WordPress.com sites. This site is built for those who are using the self-hosted WordPress.
Admin
savannah says
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
Editorial Staff says
Did you add a new plugin? Because the only thing we can think of with the information provided is that there is a plugin conflict.
Admin
Savannah says
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
Nemo says
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! ;)))))))))))))
Editorial Staff says
Always a pleasure to help
Admin
joseph says
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.
Editorial Staff says
WordPress.com and self-hosted blogs are different. But WP.com does have a carousel feature that you need to enable.
Admin
Doc4 says
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.
Abdul Rahim says
Very nice and easy tutorial.
I aslo use this plugin to create photo gallery.
Susan says
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!
Editorial Staff says
You should use a lightbox plugin for that instead of a carousel. Or you can use the carousel and only add one image in the gallery.
Admin
Susan says
Thanks. I’ll give that a try.
Susan says
Thanks again, adding the one image plus the Carousel worked VERY well for me:
myimmortals.com
Afro Arena says
Thank you very much for your article. With this, I was able to create a beautiful gallery
Willem says
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
Abbey says
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?
Editorial Staff says
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
Tanja says
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?
Editorial Staff says
Not unless you manually add that image outside of the gallery and hyperlink it.
Admin
Pamela says
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
Rob van den Brand says
Great post, I’ll probably replace NextGen with this option now.
Amar says
How about using nextgen gallery plugin for the same ?
Editorial Staff says
Why use a plugin when WordPress can do the job?
Admin