Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm trying to show the gallery in a thickbox or shutter window from a link. if i have a gallery [nggallery id=1] i want to have a link "view photos" and when i click on it a thickbox/shutter window should popup.

i have this working for shutter:

<div style="display: none;">[nggallery id=1]</div>
<a class="shutterset_set_1" href="/wp-content/gallery/a/dsc_7304mg.jpg">View photos</a>

and this working for thickbox:

<div style="display: none;">[nggallery id=6]</div>
<a class="thickbox" href="/wp-content/gallery/d/117.jpg" rel="set_6">View photos</a>

It opens but the images count is wrong.It counts the gallery images + the images in the page.In this case my gallery has 13 images but the first image(the one in the link) appears twice and then the count is 14 instead of 13.This is really annoying!!

is there a way to solve it? Is there an alternative to show the gallery via single link?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

I finally did it with jquery. I replaced all the image thumbs of the gallery with the link text and remove the text for all links except the first:

$(".ngg-galleryoverview").each(function(index) {
    $(this).find(".ngg-gallery-thumbnail-box .ngg-gallery-thumbnail a").html('View photos <span>&#187;</span>');
    $(this).find(".ngg-gallery-thumbnail-box .ngg-gallery-thumbnail a").addClass('small');
    $(this).find(".ngg-gallery-thumbnail-box:gt(0) .ngg-gallery-thumbnail a").html('');
            }); 

With this script i can use the shortcode normally, just [nggallery id=1] and it works for both thickbox and shutter.

Hope this helps someone with the same problem i had :)

share|improve this answer
add comment

protected by Community Dec 13 '12 at 14:58

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.