Support » Plugins » Linking Filterable thumbnails to Lightbox Gallery

  • daniellecarrick


    Right now, I have a Filterable portfolio on my “Portfolio Page”. Each piece/series in the portfolio has it’s own thumbnail that links to the post with a gallery of images. So, clicking on a thumbnail takes you to a new page. Instead of linking to a different page, I want the gallery to appear above the thumbnails in a lightbox on the portfolio page.

    Here is a snippet of code that shows how the thumbnail is being linked.

    <li class="<?php echo $catSlug;  ?>">
                      	  <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>" target="_top"><?php the_post_thumbnail(); ?></a>
                       	 <p><?php the_title(); ?></p>

    How can I link to a Lightbox Gallery instead?

    Thanks in advance!

Viewing 1 replies (of 1 total)
  • Hi there,

    I had the same problem and I just found a solution using PRETTYPHOTO script

    -In my file there is a loop that calls the images for filterable.
    -Prety photo simply works by linking the thumbnail to the full size and adding a “rel” attribute to the link.

    <a href="#" rel="prettyPhoto"><img src="thumnail_link"></a>

    To get the url of the full size of the post’s featured image add the following to your loop:

    <?php $src = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), false, ''); ?>
    -this stores the url in the variable $src

    then call the variable in your link as follows:

    <a href="<?php echo $src[0]; ?>" rel="prettyPhoto"><?php the_post_thumbnail( array(200, 200) ); ?></a>

    Hope this helps!

Viewing 1 replies (of 1 total)
  • The topic ‘Linking Filterable thumbnails to Lightbox Gallery’ is closed to new replies.