Use thumbnail to instigate Lightbox2 on main post image (2 posts)

  1. demonboy
    Posted 4 years ago #

    I have this line on my category.php page to pull up the assigned thumbnails of my post:

    <div id="singleimg"><?php the_post_thumbnail('custom-thumbnail-size'); ?>

    What I'd like to do is allow the user to click on the thumbnail and for the main image in the post to open in Lightbox2. The post only contains an image, no text, as this is a a photography blog. The thumbnails are different sized and shaped images to the main post image so it's not possible to use the main image as my thumbnail.

    Any clues?

  2. demonboy
    Posted 4 years ago #

    OK, I was being really thick. Well, perhaps I'm being a bit harsh on myself because I wasn't aware that WP could do this: I uploaded the full image to the post but I selected the thumbnail (150x150) option. I saved the post and the output...

    <div id="singleimg"><?php the_content (); ?></div>

    ...with lightbox2 running simply opens the full-sized image in lightbox! Voila, problem yok.

Topic Closed

This topic has been closed to new replies.

About this Topic