Posted on 18 November, 2009 By Kim Woodbridge 15 Comments

WordPress Gallery Shortcode: Add a Simple Image Gallery to a Post or Page

West Gallery entrance (by voteprime)

When I was researching the upcoming features for WordPress 2.9, I came across the following: “Add support for ‘include’ and ‘exclude’ to (Gallery Shortcode)”

I didn’t know what the gallery shortcode was all about so I looked into it and was pleasently surprised to discover a built-in WordPress feature that allows you to display a simple image gallery on a post or page.

The gallery shortcode will display all of the images that you have uploaded to that post or page as thumbnails. Here’s how you do that.

  1. Upload an image using the upload/insert button for the post or page where you want the images to display.
  2. Save the upload but don’t insert it into your post or page.
  3. Do this for each image that you want to display.
  4. Add
    [gallery]
    

    into your post or page where you want the gallery to be displayed.

The gallery will look like the following:

These are all photos of my favorite soccer goalie, Iker Casillas, who plays for Real Madrid. He has nothing to do with this post but I needed images for this article and he is one of my top ten celebrity crushes. ;-)

The gallery shortcode has a number of options that can be added to it. Some of them are:

  • columns – You can specify the number of columns for the image display
    [gallery columns="3"]
    
  • id – This will display images attached to a specific post. For example, the gallery above displays the images for this post but by using the post id number I could display the images from a different post in this one.
    [gallery id="292"]
    
  • size – will set the size of the images. The default is thumbnail but you can also use the medium and large images.
    [gallery size="medium"]
    

Obviously, this is not as full features as a gallery plugin like NextGen Gallery but for a quick and easy gallery on a post or page this shortcode works great.

I just can’t believe that I was completely clueless about it until recently.

If you want to read more about the gallery shortcode, there is information in the codex.

photo credit: voteprime


Related Posts:
  • 14 Flickr Plugins for WordPress
  • NextGen Gallery Plugin for a WordPress Portfolio
  • 11 Photoblogging Plugins for WordPress
  • 7 WordPress Photoblog Themes
  • 8 WordPress Shortcodes
  • Posted In : WordPress Tips
    If you enjoyed this post, please subscribe to my RSS Feed

    Post to Twitter   Post to Delicious   Post to StumbleUpon

    15 Responses to “WordPress Gallery Shortcode: Add a Simple Image Gallery to a Post or Page”

    Trackbacks/Pingbacks
    1. 8 WordPress Shortcodes | (Anti) Social Development
    Leave a Comment
    You may use: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> .


    Recent Comments

      • Dennis Edell: That's an option. lol .-= Dennis Edell´s last blog .....
      • Regina Fried: Guess I'll have to check with Network Solutions, then. I'm sure the line will be, "It's a WordPress problem."...
      • Kim Woodbridge: Hi Regina - Usually the issue is with the host, not with WordPress so it's been hard to "fix". But it's also been one o...
      • Regina Fried: Hi Kim, Yes, I realized I would have to update the file each time WP is upgraded (sigh). It seems like a problem that...
      • Kim Woodbridge: Hi Regina - I have a client on 2.9.2 where the problem just started too - I'm wondering if the webhost changed something...
      • Kim Woodbridge: Hi Keith - Thanks for the info - you have some interesting ideas on how to generate income from a lyrics plugin....
      • Regina Fried: Hi Kim, I'm running WP 2.9.2 on a client's site and just ran into this problem. What do you think of the idea of modi...
      • Keith from shrewdies: Now there's another one (search the WordPress Plugin Database for Happiness Today). Like Hello Dolly, Think Of Happin...