Support » Plugin: Simple Lightbox » Does not work with featured/thumbnail image

  • Resolved RogerUsh

    (@rogerush)


    In my theme I am using this code to show the featured/thumbnail image of the post:

    <?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('medium');
       echo '</a>';
     }
    ?>

    But Simple Lightbox does not hook into the code on the front end and the link goes to the image source.

    I tried adding data-slb-active="1" data-slb-internal="0" to the img tag, but it did not work. What is the best way to get Simple Lightbox to work with the featured image?

    http://wordpress.org/extend/plugins/simple-lightbox/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Archetyped

    (@archetyped)

    SLB activates links inside post, page, or widget content. Post thumbnails may be supported in the future however.

    I’ve moved on to this jquery plugin:
    http://dimsemenov.com/plugins/magnific-popup/

    Works real solid!

    Plugin Author Archetyped

    (@archetyped)

    Glad you found a solution that works for you 🙂

    I did this and it worked for me:

    <?php $FeaturedImage = wp_get_attachment_image_src ( get_post_thumbnail_id ( $post->ID ), 'single-post-thumbnail' );  ?>
                        <?php if ($FeaturedImage) { ?>
                            <div class="ListedImage four alignleft"><a href="<?php echo $FeaturedImage[0]; ?>" rel="slb slb_internal" data-slb-active="1" data-slb-internal="0"><img src="<?php echo $FeaturedImage[0]; ?>" /></a></div>
                        <?php } //End - if there was a featured image ?>
    Plugin Author Archetyped

    (@archetyped)

    I’m glad you found a solution that worked for you. Just wanted to note that all of SLB’s undocumented attributes (e.g. data-slb-internal, etc.) can change at any time, so hardcoding these values could cause unexpected behavior in a future update.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Does not work with featured/thumbnail image’ is closed to new replies.