Adding image galleries to posts and pages
Image galleries are a lovely way to share your pictures with friends, family, and your growing community. An image gallery will display a set of small images attached to a particular post or page.
With the new WordPress block editor, you can add and customize your galleries visually and with a few clicks. Let’s get to it.
Add the Gallery Block
To add a gallery of images, open a page or post and click the ⊕ inserter button inside the editor and search for “gallery.” Alternatively, you can just type
/gallery and press enter.
Add images to a gallery
In the area that loads, you’ll see two options:
- Upload – useful if you have images that you wish to upload to your website. You can drag and drop the images in that field, and your gallery will update.
- Media Library – use it if you want to select images that are already uploaded. In the window that opens, select the pictures you want to be part of your gallery and click on Create a new gallery. In the new window, you can reorder your images and click Insert gallery when you’re done.
Customize your gallery
Click on the gallery you just added, and by using the right settings panel, you can tweak options like:
- Columns: you can decide how many images are displayed in a single row. The number of available columns increases as you add more images. The maximum is 8 columns.
- Crop: useful if you have images of varying sizes and shapes (e.g., portrait and landscape) in the same gallery. With this option, you can choose if you want images show in the original format or not.
- Link to: you can decide what happens when someone clicks an image:
- Attachment page: this is a page that showcases the image, the caption, the image description, and a comment field.
- Media File: enables the images to show in a full-screen carousel that visitors can use to browse between them.
- None: clicking on your images won’t do anything.
- Image size: useful if you want to control the image quality inside a gallery. This setting will affect the overall image size and, therefore, impact that post or page’s loading speed. Our recommendation is to avoid the Full Size option.
Change the image alignment
To change it, click on the Gallery block and, in the Block Toolbar (see screenshot for details), click on the three horizontal lines and choose the alignment option you see fit. Depending on the WordPress theme you use, you’ll see different alignment options.
Reorder gallery images
This is quickly done by selecting an image from a gallery and clicking the left and right arrows.
Add captions to images and galleries
By clicking on an image inside the gallery, you will notice a Write caption area where you can add your text.
At the same time, at the bottom of each Gallery block, you’ll also see a Write gallery caption area that you can use to describe what is your gallery all about.
PS: If you want to learn more about using the blocks editor inside pages and posts, you can read this detailed article.