• Resolved Rob Cubbon

    (@robcub)


    NextGEN Gallery is awesome!

    When you upload a zip file of images it creates this HTML in the gallery for each image:

    <a href="http://website.com/wp-content/gallery/imagefilename.jpg" title=" " class="shutterset_set_2" >
    <img title="imagefilename" alt="imagefilename" src="http://website.com/wp-content/gallery/thumbs/thumbs_imagefilename.jpg" width="150" height="150" />
    </a>

    Which is great it creates the title of the thumbnail to be the same as the filename meaning it pops up when the visitor hovers over the thumbnail.

    However, I would like the visitor to see the filename on the larger view so when they click the title is “imagefilename” so it appears on the shadowbox/lightbox as the “caption”. For this to happen I need the HTML to be:

    <a href="http://website.com/wp-content/gallery/imagefilename.jpg" title="imagefilename" class="shutterset_set_2" >
    <img title="imagefilename" alt="imagefilename" src="http://website.com/wp-content/gallery/thumbs/thumbs_imagefilename.jpg" width="150" height="150" />
    </a>

    The difference being that the title of the a href tag is “imagefilename” and this causes lightbox/shadowbox to put the image name as a sort of “caption” above the image which is what I want.

    I could go through the gallery, in Gallery > Manage Gallery and copy and paste in the Alt & Title Text / Description but I have hundreds of images so I’d rather not do that.

    Is there anyway to have the filename as the title of the anchor tag?

    Sorry for long-winded explanation

Viewing 7 replies - 1 through 7 (of 7 total)
  • Wondering if you found a solution for this, robcub.
    I need also the file name appearing as the image title.
    With mass uploads it’s not doable to do this manually every time.
    Thanks for any light on this.

    Thread Starter Rob Cubbon

    (@robcub)

    Yes, Pieter, Karl Peschel at the LI WordPress group came to the rescue:
    http://www.linkedin.com/groupItem?view=&gid=154024&type=member&item=223362863&qid=8347661e-257a-439d-8833-759dda73014d&trk=group_search_item_list-0-b-ttl

    Does that link work for you?

    You have to hack the plugin and use the [ nggallery id=X template=caption ] shortcode. But it’s real easy. Let me know if you need any help.

    Thank you Rob.
    I implemented that solution from Karl, but to no avail.
    My “description field” stays empty in the gallery. And so nothing appears underneath the thumbnail.
    I do have it in the first field (Alt). It should appear in both fields, right?
    I must have made some stupid mistake I guess.

    On the other hand I was hoping for a built-in solution with the new NextGen Gallery 2.0 that just came out, but nope AFAIK.

    Any idea?

    Thread Starter Rob Cubbon

    (@robcub)

    As far as I remember the description field in the gallery doesn’t get filled in.

    You’re telling it to display the alt text as the caption by making the change to the plugin’s code and making sure there’s a caption by adding the shortcode [nggallery id=X template=caption] where you want the gallery.

    Are you sure you’ve done those two things correctly? Experiment by changing the alt / title and description fields in the gallery and seeing which one comes up.

    I found the solution that works for me. Don’t ask me why it is different from yours 😉

    In gallery-caption.php on line 47 I changed only:
    <span><?php echo $image->caption ?></span>
    into:
    <span><?php echo $image->alttext ?></span>

    Maybe this has to do with the way we display it differently? I don’t know, but finally I get the alttext (which is the filename) as the caption underneath the thumbnail.
    Thanks a lot anyway for pointing into the right direction.

    Thread Starter Rob Cubbon

    (@robcub)

    Great you’ve found a solution, Pieter. Hopefully this thread will help someone out in the future! 🙂

    Thread Starter Rob Cubbon

    (@robcub)

    I’ve marked it as Resolved 🙂

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Plugin: NextGEN Gallery] filename as the title of the anchor tag’ is closed to new replies.