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




Keep Reading:
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. If you are looking for Hosting, WordPress Theme, Newsletter or other recommendations, please view my detailed list

.


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

    • Fred: Thank you for this post. I am using NGG slideshow in the header of a site and I would like the slideshow to cycle thr...
    • Nick: Has anyone found an app that allows you create a "favorite" (the little box) where it is an image you define and it link...
    • Rajesh: Hey , really great... its help me a lot to fix the issue in IE..... thanks......
    • oliver: Thank you very much. This is exactly the solution I was hoping for....
    • Rick Wolff: I'm considering a graphic design specialization: custom blog post images designed to be eagerly shared on Pinterest. I g...

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