Blocks

Blocks »Gallery Block

Please note this instructions refer to the Classic editor only. If you would like to insert a gallery to a page or a post using the Block Editor please click here.

Image galleries on WordPress.com are a great way to share your pictures with your friends, family, and your followers. An image gallery will display a set of small images attached to a particular post or page. Readers can click on any image to launch a full-size carousel that allows them to scroll through the entire gallery one image at a time. With the slideshow option, images will automatically move from one to the next after a few seconds.

You have several choices for how a gallery will be displayed in your post: a thumbnail grid layout, a tiled mosaic-style layout, or in a slideshow. All sites default to the thumbnail grid style.

Tiled layouts can display in one of three styles: rectangular tiles, square tiles, or circular tiles. Along with looking great, the rectangular and square tiled layouts also have hover-over captions to save space while making captions accessible. (Check out examples of all three layout options in this post.)

To switch to tiled layouts from the default, head over to Settings → Media in your blog’s WP-Admin Dashboard, scroll down to Image Gallery Carousel and select the box next to “Display images in full-size carousel slideshow.” Note that choosing this option makes this layout the default for all your blog’s galleries, including those you’ve previously inserted.

When clicked, gallery images are displayed in a full-size carousel view, which you can customize from the Image Galleries Carousel section of the Media Settings.

Below is an example of an image gallery using the default thumbnail setting. If you click on any of the images you will be able to see what the carousel view looks like:

↑ Table of Contents ↑

  1. Open a post or page for editing. If it is a new post or page, make sure to add a title and save it at least once before trying to insert a gallery or slideshow.
  2. Click the Add Media button.
  3. Then click Create Gallery on the left hand side. You’ll now see the images in your Media Library. You can add new images from the web with the Insert via URL option, or you can add new images from your computer by clicking on Upload Files, navigating to the images on your computer, selecting them, and clicking “Open”. Here’s more information on adding images.
  4. After the images have finished uploading, you can deselect any you don’t want to include in the gallery by clicking on them — click again to re-select.
  5. When you’ve selected all of the images you’d like, click Create a new gallery at the bottom right to proceed to the gallery settings.
  6. On the following screen you will see a preview of your gallery. You can change the layout with the Type dropdown:
  7. You can remove images, drag them to a different place to change the order, or add captions. You can also edit the following options, which will be available based on the currently chosen layout:
    • Link to: Does not apply to slideshows.
      • Attachment Page: A specialized page in your blog that shows the image in your selected theme.
      • Media File: A direct link to the full-size uploaded image.
    • Columns: The number of columns of thumbnails to display. This may be affected by your choice of theme, so be sure and test a bit with your current theme. This option does not apply to slideshows.
    • Random Order: Check this box to randomize the order of images in your gallery or slideshow. That means the order will change randomly every time the page is loaded.
    • Type: Specify the type of gallery here. The options are a default gallery of thumbnail images, a gallery with rectangular tiles, a gallery with square tiles, a gallery with circular tiles, or a slideshow.
  8. When you’ve finished editing your gallery, click Insert gallery.

↑ Table of Contents ↑

  1. Open a post or page with a gallery for editing.
  2. Click on the gallery and then click the pencil icon that appears.
  3. Adjust the Gallery Settings if necessary.
  4. Make sure to click the Update gallery button to save your settings.

↑ Table of Contents ↑

The gallery shortcode can be used in its simplest form like this:

[gallery]

Insert the shortcode into a shortcode block (if using the block editor) or directly in the page content (if using the classic editor.)

This shortcode will display the images attached to the post or page.

Note that after you’ve published or updated a post or page including the gallery shortcode, the Visual editor will no longer display the shortcode itself. To edit an already-entered shortcode, simply switch to the Text editor, where you will be able to see and edit the code.

To insert a tiled gallery, add the relevant shortcode addition after “gallery”:

type=”rectangular”
type=”square”
type=”circle”

To insert a slideshow gallery type, use this shortcode:

[gallery type=”slideshow”]

You can also pass other settings with the gallery shortcode.

OptionDescriptionChoicesDefault Setting
columnsNumber of columns used to display the imagesAn integer greater than 0 (not valid for the default rectangular grid)3
typeType of image arrangement to display“thumbnail”,”rectangular”, “square”, “circle” or “slideshow”.rectangular
orderbyHow to order the imagesID, menu_order, rand, title + ASC, DESCmenu_order ASC, ID ASC
sizeSize of the images to displaythumbnail, medium, large, full (only valid for the default thumbnail grid)thumbnail
autostartStart the slideshow on page load“true” or “false”true
idThe gallery will display images which are attached to that post.Any post or page ID that has images attached to itDefault is to show the gallery post
includeThe gallery will include specific imagescomma separated attachment IDs – include=”23,39,45″N/A
excludeThe gallery will exclude specific images. If this option is being used, other attached images won’t be added to the gallery.comma separated attachment IDs – exclude=”24,30,43″N/A

Note: To get an attachment ID for an image, go to your Media Library and click on the title of the image you want. You can find the ID in the URL (the number after post=).

link-image-id

You can follow almost the same steps for getting a post ID. Instead of going to your Media Library though, go to your Posts screen and then click on the title of the post you need.

Examples:
[gallery id=”402″]
[gallery columns=”5″ orderby=”title DESC, ID ASC”]


↑ Table of Contents ↑

You can also manage gallery styles individually. To do so, go to Settings → Media. Under the section Image Gallery Carousel, uncheck the box Display all your gallery pictures in a cool mosaic and click Save, to keep the default thumbnail grid layout across your site.

media-settings

When you want to include a gallery in a post, insert it as usual and then simply switch over to the Text tab in the post editor and add the code for the gallery style you want to use (see Gallery Shortcodes).

If you do not add a style, it will default to the thumbnail grid layout.


↑ Table of Contents ↑

Troubleshooting

If you have trouble creating a gallery in your post, try entering the title and saving it as a draft before you upload any images.


↑ Table of Contents ↑

Learn more

Photoblogging Made Easy: Exploring Gallery Types (The WordPress.com Blog, March 12, 2014)

Pages: 1 2 View All

Not quite what you're looking for?

Get Help