Tag Gallery
A few days ago I was looking for a better way to manage galleries in WordPress for a friends new site. We found it rather awkward to deal with the built in gallery short-code when it came to removing images from a gallery or even adding them. It seems ridiculous that media must be uploaded through a post or page to add it to a gallery. Even more annoying is that you must delete an image from the Media Library as a whole just to remove it from a gallery on any given page. This is rather unintuitive. I think media should be managed completely by the Media Library and attached/unattached from pages or posts at will. The post should simply be a vehicle to display media, not a part of the management of such.
I went searching for a better gallery implementation and of the 300 or so image plugins available none of them seem to do what we wanted. I don’t want to install a whole new media management system such as NextGen gallery as WordPress already provides a Media Library. I don’t want to host my media with an external provider as I would much rather keep control of my assets in one place: my blog. I want to manage media in a more intuitive manner and very much like the gallery short-code without the shortcomings.
I found Justin Tadlock’s Cleaner Gallery which cleans up the built in gallery and allows for very easy inclusion of java-script lightbox effects such as the Thickbox which is included with WordPress. Cleaner Gallery is a step in the right direction but still does not overcome the cumbersome management of the galleries, and it was never meant to! Shortly after I found Paul Menard’s Media Tags plugin which is absolutely great. So why not mash up the two into a Cleaner Gallery managed by Media Tags!
Introducing Tag Gallery. It’s a quick piece of work and solves the issues of managing galleries, at least for me. Your mileage may vary. It is a short-code implementation and you can include as many of them as you wish on any given post or page. You can set the thumbnail width and height and whether or not to show captions. If you have Cleaner Gallery installed it will use your java-script settings from that plugin for the display of your tag-gallery. In fact, Tag Gallery generates the same markup as Cleaner Gallery and even includes the CSS from that plugin. Why reinvent the wheel when you can maintain compatibility?
Tag-Gallery Short Code Two Tag Galleries Displayed Tag-Gallery with Thickbox Profile Pic One Profile Pic Two My nephew and I.
To use Tag Gallery simple add tags to your images in the Media Library (as long as Media Tags is installed!) and insert a short code similar to the following into your post or page:
[tag-gallery tag=mytag columns=3 captionson=false theight=150 twidth=150] What this tells Tag Gallery is to get all the images from the Media Library with the tag ‘mytag’ and create a gallery three columns wide, without captions, and make the thumbnails 15opx square. Of course, you need to wrap your short code in square brackets. At the moment, I don’t know how to show a short tag example with brackets without it being processed by WordPress. Any clues to do so would be greatly appreciated. Installed Code Colorer. Seems to be working well enough.
So with the previous short-code we would end up with something like the following:
Tag-Gallery Short Code Two Tag Galleries Displayed Tag-Gallery with Thickbox By default, captions are set to false and thumbnails are set to 150px width and height. Columns default to three and tag is set to ‘tag.’ If Tag Gallery can’t find your tag in the Media Library it will not display anything. The following Tag Gallery has our thumbnail size set differently than the previous example. Specifically, I set the ‘theight’ property to 100.
Tag-Gallery Short Code Two Tag Galleries Displayed Tag-Gallery with Thickbox
The plugin does not have any test cases and has only been used with WordPress 2.9+ so I can’t say whether it works with any previous versions. Let me know if you find it works with them or not. Honestly, your WordPress should be kept up to date but I understand some people have their reasons to keep with an older installation. I don’t recommend it though. If the plugin finds itself useful for people I will add features and fix any bugs that arise as I am made aware of them. Check the readme.txt in the plugin for a list of options and what not. Let me know if you find a bug and I hope you enjoy this simple but effective plugin. Finally, I would like to thank Paul Menard and Justin Tadlock for their great plugins, without which, Tag Gallery would have been much more work. Cheers and Aloha
54 Comments. Content restored from the Internet Archive. Thank you!
This is personal technical debt at work folks. Tend your fields. lol