Hidden Gallery Shortcode for WordPress

*** Updated ***

Well, ok … it’s not a hidden tag, but it is a feature many of us aren’t aware of in WordPress.

I have seen many people on Twitter asking for a good Gallery plug-in for WordPress. Our choice for a plug-in would be NextGen. But, it occurred to me that many people don’t realize that WordPress has this feature built in already. It’s not the prettiest or the coolest gallery I have seen. But it does the job in a pinch.

The setup for a gallery is very easy. And inserting it into a post or page is done with a “shortcode”.

First, start a new post and give it a title. Then, using the Media Toolbar, add in your images. The Media Toolbar is that row of icons just above the editing area start with “Upload/Insert”. Click on the first icon to open the Media Uploader.

I have trouble with the Flash Uploader so I use the Browser Uploader.

I upload my image, and select the options I want for that image. DO NOT click on “Insert into Post”. ONLY click on the “Save all changes” button. Your image will then be added to the Gallery and this will be reflected in the Media windows tabs.

Add as many pictures as you want, always clicking on “Save all changes”. You will see the number of images in your gallery increase. After uploading and clicking the correct button to save, you are always taken to the gallery tab. After you have uploaded you last image, select the option you want for your gallery. When you’re finished, click on “Insert Gallery”.

You should now see a Gallery shortcode appear in your post similar to the following:
[

1
gallery link="file" orderby="post_name"

]

You can also assign your own tags for enclosing the various elements of the image gallery. I have select tags to enclose my items, thumbnails and captions.
[

1
gallery link="file" orderby="post_name" itemtag="div" icontag="span" captiontag="p"

]

Here is my result (courtesy of Matt Stuart):

There is more about this shortcode in the WordPress Codex.

Update: We have found a Lightbox plugin for this WordPress Gallery code as well. You can get the plugin here. We have been very pleased with this plug-in as it gives your site that extra needed level of professionalism for photo galleries in WordPress. Have a look at our implementation of this WordPress Lightbox Gallery Plug-in.

11 thoughts on “Hidden Gallery Shortcode for WordPress

  1. Thanks! I’m new to WordPress and had been trying to figure out how to do this. Other instructions I’d found weren’t as clear. I appreciate the explanation/instructions.

  2. I just stumbled across your post today when trying to figure out if I can control which images go in the gallery? Say I have 3 images that I want to be a gallery and then just one image floated in the text.

    Do you know if I can remove the 4th image from the gallery, it seems it adds it in automatically? (i’m using wordpress 2.8.4)

  3. Hi there
    Thanks for the great easy explanation. Is there anyway to upload pictures to categories? I would like to seperate my pictures into categories…

  4. Unfortunately, there isn’t a straightforward way to do this specifically for each image. However, you can assign a Category to the post that would contain photos specific to that category. This isn’t really assigning the photos to a category but it does help a little.

  5. Would you know how to edit the Gallery shortcode so that it links the image to nothing? I simply want to display the gallery, not have it linked to the file or attachment page. I’ve Googled for a while now and found nothing on how to change this. It seems simple enough!

    Thanks in advance.

  6. Thanks for this post! I just discovered that WordPress had this feature today, but I did not have any idea how to use it and I came across your page while looking for an example.

  7. I am not an expert in WordPress so I was not aware of this fact . Thanks for making me aware that I can do this also in wordpress.

  8. I, like Jeff Tovar, would also want to know how to go about editing the gallery shortcode… in my case I’d like to add around all the images that are in a gallery

Comments are closed.

 
 
 
%d bloggers like this: