WordPress.org

Ready to get started?Download WordPress

Forums

Linking Filterable thumbnails to Lightbox Gallery (2 posts)

  1. daniellecarrick
    Member
    Posted 2 years ago #

    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>
                    </li>

    How can I link to a Lightbox Gallery instead?

    Thanks in advance!

  2. lamarke
    Member
    Posted 1 year ago #

    Hi there,

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

    First.
    -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!

Topic Closed

This topic has been closed to new replies.

About this Topic