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:
  • NextGen Gallery Plugin for a WordPress Portfolio
  • 11 Photoblogging Plugins for WordPress
  • 7 WordPress Photoblog Themes
  • 8 WordPress Shortcodes
  • (Anti) Social Lists 1/10/10
  • 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

      • Kim Woodbridge: HI Dennis - That's exactly right - it's like a macro for WordPress. Don't the Office programs still use them?...
      • Dennis Edell: Anyone needing to ask what a macro is, please do it privately...I hate looking so old in public. LOL! .-= Dennis Edell´s...
      • Kim Woodbridge: Hi Juncai - There isn't any mention of the alt tag in the fbml documentation for the share tag. I tested it by adding i...
      • Dennis Edell: The commonly used link is awesome. Kinda like a modern day macro, yes? .-= Dennis Edell´s last blog .....
      • Kim Woodbridge: Hi Shirley - I would be happy to answer your questions but I don't understand them. Are you referring to the Facebook s...
      • Kim Woodbridge: Hi Dennis - I could never park a car like that - even lining it up with the door in order to get into the house :-)...
      • Kim Woodbridge: Hi Carla - I didn't mean to sound snippy - I am a little irresponsible about it. I could get ok insurance if I tried h...
      • Kim Woodbridge: Hi Jamie - Thank you so much! And I'm really glad this helped you get the video on your fan page :-)...