Posted on 18 November, 2009 By 17 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:

Posted In : WordPress Tips

Did you enjoy this article? I can assist you with your WordPress or Facebook project. Contact me and I will provide you with an estimate. You can also connect with me on Facebook or follow me on Twitter.




web hosting by media temple

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

Trackbacks/Pingbacks
  1. 8 WordPress Shortcodes | (Anti) Social Development
  2. How to Include and Exclude Images with the WordPress Gallery Shortcode | WordPress and Facebook Consultant | (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> .

CommentLuv badge

About

Kim Woodbridge is an accomplished Information and Technical Consultant specializing in the entire implementation of a WordPress based website including installation, theme design, upgrades, unique customizations and ongoing site maintenance.

Recent Comments

    • Marbella: Hi Kim, To get a Valentine card from a child who has been working with it for a few days means so much. They show their...
    • Gaynell M. Jones: Hi Kim, Wow, This is amazing! How can you read this much and blog at the same time?.. Well I'm not that a reader myse...
    • Gaynell M. Jones: Wow! This are cute! I will creat this for my darling. Thanks for the sharing this wonderful Idea....
    • Cmack: I found this website that shows how to have thumbnails link to another page by using the alt/title info in the gallery. ...
    • Lily Rose: This is so cute! I love it when people make their day and do the same for their close ones...

Wordpress Services

  • Installation, upgrades and maintenance
  • Conversion of existing html and css templates
  • Theme and plugin recommendations
  • CSS customizations
  • Troubleshooting and tweaks for unique situations
  • Customization for individual blogging goals and needs
  • Training and advice