WordPress.org

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 1 year 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 1 year 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 1 year 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 1 year 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 1 year 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 1 year ago #

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WP Gallery Custom Links
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.