A guide to Cleaner Gallery

Cleaner Gallery was written to take care of the invalid XHTML that WordPress produces when using the [gallery] shortcode.

It does a bit more than that though. It will integrate with many Lightbox-type scripts and allow you to do much cooler things with your galleries. Plus, it has a couple of extra options that you can play around with.

How to install the plugin

  1. Uzip the cleaner-gallery.zip folder.
  2. Upload the cleaner-gallery folder to your /wp-content/plugins directory.
  3. In your WordPress dashboard, head over to the Plugins section.
  4. Activate Cleaner Gallery.

How to use the plugin

Once you've activated the plugin, you don't have to do anything else for clean, valid XHTML galleries.

However, there are a few options you can set. Go to Cleaner Gallery, which is located under your Appearance menu in your WordPress dashboard. From there, you'll see several settings to choose from.

Oh yeah, you might want to know how to actually use the gallery shortcode as well. I would say that's fairly important.

Gallery Settings

The Image Link setting will override the WordPress gallery link and allow you to link your images how you want.

The Captions settings are pretty self-explanatory. You can choose to remove all captions, use the image title when no caption is present, and/or link the captions to the image attachment page.

JavaScript Settings

I imagine this is the reason many of you downloaded the plugin. It will integrate nicely with many different Lightbox-type scripts. Here is the officially supported list. This plugin has been tested and works with any of these.

To use one of these, you only need to load the appropriate JavaScript and/or CSS and select one from the Image Script drop-down box (see below if your script is not listed here).

Auto-loading Thickbox

Thickbox is a script that is included with WordPress, so you have the option of doing nothing other than selecting a couple of checkboxes.

That's it! Choose Thickbox from the Image Script drop-down and check the Thickbox JavaScript and CSS boxes and look at your new galleries.

Using an alternate script

If you're using a Lightbox-type script that this plugin doesn't support yet, you should let me know. I'll be happy to add the appropriate code. Since it's usually a while between updates, I've added two input boxes for adding custom class and rel attributes to each gallery item. Most Lightbox-type scripts require one or both.

You might input something like justinbox in the class input box and justinbox[gallery-id] in the rel input box.

Take note that by inputting id in either box, the gallery will automatically exchange that with a unique ID so that you can have more than one gallery on a page (i.e. your blog's home page).

Plugin support

I run a WordPress community called Theme Hybrid, which is where I fully support all of my WordPress projects, including plugins. You can sign up for an account to get plugin support for a small yearly fee ($25 USD at the time of writing).

I know. I know. You might not want to pay for support, but just consider it a donation to the project. I am fully employed through my work with WordPress, so to continue making cool, GPL-licensed plugins and having the time to support them, I must pay the bills.

Copyright & license

Cleaner Gallery is licensed under the GNU General Public License, version 2 (GPL).

This plugin is copyrighted to Justin Tadlock.

2008 © Justin Tadlock