WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] the_post_thumbnail in a popup window (4 posts)

  1. derrickallen
    Member
    Posted 1 year ago #

    Hey Gang!
    I'm currently using code, to link the post thumbnail to it's full size image,from this article:

    http://codex.wordpress.org/Function_Reference/the_post_thumbnail
    Section: Post Thumbnail Linking to Large Image Size.
    This example links to the "large" Post Thumbnail image size and must be used within The Loop.

    The code is:

    <?php
     if ( has_post_thumbnail()) {
       $large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large');
       echo '<a href="' . $large_image_url[0] . '" title="' . the_title_attribute('echo=0') . '" >';
       the_post_thumbnail('thumbnail');
       echo '</a>';
     }
     ?>

    This causes the photo to link to it's full size but moves the page forward to its own page for the picture and then the reader has to go back. Is there a way to call the post thumbnail and make it popup in it's own browser window or even better, in its own pretty popout window without being a browser? I've been looking at the csspopout.js stuff that's out there but I can't figure out how to incorporate it with the functions above. Any ideas?

  2. derrickallen
    Member
    Posted 1 year ago #

    Hrmm no takers yet. Ok.

    Do we think maybe there's a better way to pull up the_post_thumbnail so that it's easier to make it a popout?

  3. esmi
    Forum Moderator
    Posted 1 year ago #

    Try looking for a suitable lightbox plugin.

  4. derrickallen
    Member
    Posted 1 year ago #

    FINALLY got this working. I installed WP jQuery Lightbox.

    Then I just inserted the lightbox tag into the existing a href of the PHP code I was using before and the images starting hyperlinking to the lightbox instead of the full page. yay :)

    <?php
     if ( has_post_thumbnail()) {
       $large_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large');
       echo '<a href="' . $large_image_url[0] . '" title="' . the_title_attribute('echo=0') . '" rel="lightbox">';
       the_post_thumbnail('thumbnail');
       echo '</a>';
     }
     ?>

Topic Closed

This topic has been closed to new replies.

About this Topic