Support » Plugin: File Gallery » Lightbox

  • Resolved Francesco Canovi


    Thank you for this amazing plugin.
    I’m wondering how to set a rel=”lightbox” attribute to the “a” tag of the default gallery template, as I need it to make the lightbox effect of my theme work with the gallery.
    Any ideas?

Viewing 10 replies - 1 through 10 (of 10 total)
  • I’m suspecting that it’s a bug, cause for me there is no way to make file gallery to put any rel value, and there is no default setting for it.

    Plugin Author Aesqe


    @thedarkmist: you need to do one or both of the following things for it to work, as it is done automatically.

    1. on the media settings screen, add your rel tag name to the “Auto enqueue lightbox scripts for which link classes (separate with commas)?” field (that would be ‘lightbox’ in your case)

    this will add a rel attribute of value ‘lightbox[gallery_number_in_post]’ to your links (for example: lightbox[1]), but only if gallery items are linked to files, and not attachment pages.

    2. you can then filter the values of the link rel attribute, link class attribute and image class attribute by using the ‘file_gallery_lightboxes_options’ filter (see example here: File Gallery help file)

    if you don’t want to use a filter, just tell me which lightbox plugin you are using and I’ll gladly add it to the supported list 🙂

    Thanks for your reply, Aesque!
    It sounds a little tricky for a non-developer. As lightboxes effects are often used, maybe it would be better to make them configurable (I mean the rel and classes) fully from the file gallery options?
    Thanks for your job.

    Plugin Author Aesqe


    @thedarkmist: I will add the option to have a custom rel value, this indeed seems too complicated for the average user.
    thanks for your feedback 🙂

    Plugin Author Aesqe


    added in v1.7-RC7, you can download it from here:

    please let me know if everything works alright, thanks! 🙂

    Hey – This is a GREAT plugin! Thank you. The attachment management itself is such a life saver.

    But I can’t get the lightbox to work. I’m no programmer, either.

    I had Lightbox Plus installed, but File Gallery disabled it, I guess. I’m wondering if you can support that or if you recommend a plugin that will support and work with FIle Gallery!?


    Plugin Author Aesqe


    @worldrider: Lightbox Plus and File Gallery can work together if you:

    1.) disable Lightbox Plus’ “Use For WP Gallery” option

    2.) on WordPress “Media Settings” page, add jquery-colorbox to the list of supported lightbox scripts (option “Auto enqueue lightbox scripts for which link classes (separate with commas)?”)

    3.) when inserting a gallery, use jquery-colorbox as link class, and lightbox as rel attribute value

    That should work just fine.

    Sorry it took me this long to answer :/



    Great plugin, thanks!
    I also have a lightbox issue.
    When viewing multiple blog posts on one page, each blog post having its own “gallery via insert file gallery; Lightbox doesn’t know to separate these “groups” of photos. They ammase into one large lightbox cycle. I even try different settings, but its doesn’t seem to help, my code ends up having the same rel value as before

    <a title="Sydney 013" href="" rel="lightbox[group]">
    For an example you can go to the “blog” page via the href above

    Am I missing something?

    Plugin Author Aesqe


    @gstricklind: the problem is with your theme’s “main.js” file, in which it is hardcoded that all gallery links get a ‘lightbox[group]’ rel value.

    I’m afraid there’s nothing File Gallery can do about that.

    To fix this, you should change the code in your theme’s “/js/main.js” file from this:

    // sets the lightbox
    $(".gallery a").each(function(){
    	$(this).attr("rel", "lightbox[group]");

    to this:

    // sets the lightbox
    $(".gallery a").each(function(){
    	var post_id = $(this).parents(".post").attr("id").replace("post-", ""),
    		gallery_id = $(this).parents(".gallery").attr("id").replace("gallery-", "");
    	$(this).attr("rel", "lightbox[group-" + post_id + "-" + gallery_id + "]");

    that way, each gallery will have a unique rel value and they will not mix.

    Awesome! Thank you very much!!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Lightbox’ is closed to new replies.