Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter hawkeye126

    (@hawkeye126)

    The fix:

    Replace

    the_post_thumbnail();

    with

    <?php $featured_img = wp_get_attachment_image_src ( get_post_thumbnail_id ( $post->ID ), 'single-post-thumbnail' );  ?>
    <?php if ($featured_img) { ?>
    <div class="lightbox-img featured-img-wrap">
    <a href="<?php echo $featured_img[0]; ?>" rel="lightbox"><img src="<?php echo $featured_img[0]; ?>" /></a></div>
    <?php } ?>

    Its not working for me,

    I apologize, new to WP and want to add this to my site at grungyape.com.

    Plugin installed, just not following your suggestion on adding it to my featured images.

    I use a child theme, on what page do I need to make your suggested edit? That may be all I ma missing.

    Thanks in advance.

    Do it in the file that displays the featured image. It could be your single-post.php. Could be /wp-includes/post-thumbnail-template.php

    Link the featured image with this:

    <a href="<?php
    $feat_image = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );
    echo $feat_image;
    ?>" rel="lightbox">

    Don’t forget to close the link off.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to enable lightbox on featured image.’ is closed to new replies.