WordPress.org

Ready to get started?Download WordPress

Forums

WP Gallery Custom Links
[resolved] I've set my gallery to keep Lightbox effects but doesn't launch media (6 posts)

  1. bucchow
    Member
    Posted 7 months ago #

    The link / lightbox effect works fine on a regular image embed but is not working with the WP Gallery. You'll see both examples on this page: http://ryancreighton.net/clips-test/ Thanks for any help!

    http://wordpress.org/plugins/wp-gallery-custom-links/

  2. fourlightsweb
    Member
    Plugin Author

    Posted 7 months ago #

    I'm not familiar with your theme/plugin for doing the shadowbox, but I noticed that on the first image, the link "rel" attribute looks like this:

    rel="shadowbox[sbpost-145];player=swf;width=640;height=385;"

    and on the gallery image the rel looks like this:

    rel="shadowbox[sbalbum-15];player=img;"

    I'm guessing that the rel on the gallery image needs to match the one on the standalone image, or at least have "player=swf" since it's a video, but I'm not sure how you'd change that for your particular site. Maybe jQuery?

  3. bucchow
    Member
    Posted 7 months ago #

    Ah, gotcha. Do you have a lightbox plugin that works well with WP Gallery Custom Links? I'm using the plugin Shadowbox JS for the lightbox feature. I'd rather swap it out for a different one that works with WP Gallery Custom Links. I appreciate the help.

  4. fourlightsweb
    Member
    Plugin Author

    Posted 7 months ago #

    Technically it *is* working with your plugin, but your plugin appears to be assuming gallery items will be linked to images and brings up the image viewer even though the links are for videos. Try putting the following in your footer to change the rel attribute on gallery images from "img" to "swf" for the video player:

    <script>
    var galleryImages = jQuery('#gallery-2 .gallery-icon a');
    galleryImages.each(function(){
      var currentRel = jQuery(this).attr('rel');
      var videoRel = currentRel.replace(/player=img;/,'player=swf;width=640;height=385;');
      jQuery(this).attr('rel',videoRel);
    });
    </script>

    You may need to tweak this script depending on which galleries/images you want to use it on, etc.

  5. fourlightsweb
    Member
    Plugin Author

    Posted 7 months ago #

    Actually, you might want to put that in the footer before where the shadowbox script is included, so the changes go in before shadowbox loads with the rel attributes that are there.

  6. fourlightsweb
    Member
    Plugin Author

    Posted 7 months ago #

    Marking this as resolved since the poster has no further input.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.