Blog

NextGen Gallery: Choosing a gallery template when displaying an album

  • July 25, 2013

Apologies for neglecting my blog of late! I’ve been working on creating and updating several websites and hope to post news of them soon.

While working on a new WordPress website for a client, I came across a small problem for which I couldn’t find a fix on the internet. Having managed to solve it, I thought I’d post it in case it helps others.

My client wants to include a photo gallery as a central feature of her website. As NextGen Gallery is far and away the best WordPress gallery plugin, I installed it and began to configure and customise it for her needs.

She requested that there be one Gallery page containing thumbnails and titles for several sub-galleries, which when clicked on would show a carousel-type display, with one large image and several smaller thumbnails. NGG supports all of these features, by creating several galleries contained within an album and choosing the right display templates.

However, when using the shortcode to display an album, the only documented parameters allow you to specify the IDs of which albums should be displayed, and the template to use for this display (by default, either compact or extended) e.g. [ album id=1 template=extended ]. There didn’t appear to be a way to say which template the galleries inside the album should use for their display.

Other people seem to have had the same issue (see this WordPress support topic) but with no solutions other than modifying the plugin code, which is not ideal as it makes upgrading difficult.

After digging around in the code a little, I discovered that there is actually a third parameter for the album shortcode called gallery, which allows you to specify a gallery template like this: [ album id=1 template=extended gallery=carousel ]

This is exactly what I needed, and works perfectly. I hope this tip works for you too and can save you some time!