Slug-based media-tag galleries in Wordpress

Slug-based media-tag galleries in WordPress

I altered Johnny Peck’s excellent Tag Gallery WordPress plugin to allow the automatic generation of image galleries based on the post slug.

This means that if you have images tagged using the media-tags plugin, simply creating a post with a slug matching the required tag and entering the shortcode will auto generate a gallery in the post of all the appropriately tagged images.

This would be useful if you wanted, say, all your ‘landscape’ images on a post called My Landscapes (with the slug set to landscape) along with some description.

A working example will be located at shortly.

I’ve thrown this up on github in case this is any use to anyone:

The standard shortcode is extended to [tag-gallery tctagslug="true"]. If tctagslug="true" is removed, the plugin operates as originally intended. This version of the code results in a gallery that links to the attachment pages, but the standard way is just commented out (around line 137). To get this to work I used the function listed here.