WordPress.org

Ready to get started?Download WordPress

Forums

File Gallery
[resolved] Lightbox (11 posts)

  1. Francesco Canovi
    Member
    Posted 2 years ago #

    Hi.
    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?
    Regards,

  2. Francesco Canovi
    Member
    Posted 2 years ago #

    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.

  3. Aesqe
    Member
    Plugin Author

    Posted 2 years ago #

    @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 :)

  4. Francesco Canovi
    Member
    Posted 2 years ago #

    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.

  5. Aesqe
    Member
    Plugin Author

    Posted 2 years ago #

    @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 :)

  6. Aesqe
    Member
    Plugin Author

    Posted 2 years ago #

    added in v1.7-RC7, you can download it from here: http://wordpress.org/extend/plugins/file-gallery/download/

    please let me know if everything works alright, thanks! :)

  7. worldrider
    Member
    Posted 2 years ago #

    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!?

    Thanks!!

  8. Aesqe
    Member
    Plugin Author

    Posted 2 years ago #

    @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 :/

  9. gstricklind
    Member
    Posted 2 years ago #

    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="http://test.stricklindphotography.me/files/2012/01/Sydney-013-1024x682.jpg" rel="lightbox[group]">
    For an example you can go to the "blog" page via the href above

    Am I missing something?

  10. Aesqe
    Member
    Plugin Author

    Posted 2 years ago #

    @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.

  11. gstricklind
    Member
    Posted 2 years ago #

    Awesome! Thank you very much!!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic