In: WordPress
7 Dec 2009*** 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:
[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.
[gallery link="file" orderby="post_name" itemtag="div" icontag="span" captiontag="p"]
Here is my result (courtesy of Matt Stuart):
Reflection
Dog
Train
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.
We provide simple, easy to understand web design services and web site hosting, specializing in Wordpress and Shopping cart applications. With 10 years of experience in Online Marketing and Search Engine Analysis, we can show you how to maintain good visibility for your online presence at a cost that won't break your budget.
6 Responses to Hidden Gallery Shortcode for WordPress
Matt Brewster
August 27th, 2009 at 4:38 pm
Thanks for this, never knew it existed!
Vincent
September 28th, 2009 at 9:22 am
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.
Jenny
October 6th, 2009 at 4:39 am
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)
Jen
November 3rd, 2009 at 1:10 am
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…
Eric
November 3rd, 2009 at 11:08 am
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.
Jeff Tovar
December 11th, 2009 at 12:03 pm
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.