• Resolved anoukgo

    (@anoukgo)


    hi.

    I have the image in every post add as featured image.
    In the list of posts I show images as small thumbnails, when the single post is open image is shown as medium size…

    I would like that when someone clicks on image in post, the image would pop up as lightbox or something, in the same page above the content.

    I tried to use some plugin.. but you have to put class=”wplightbox”..
    For the images I put in ‘Pages’ I know where to put class.. but for the images that are in posts (featured images) where could I put this code…? in which file?

    I hope you understand me 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • Theme Author Silkalns

    (@silkalns)

    For that you need to slight edit content-single.php file that you can find in Dazzling theme folder.

    Replace this line of code:

    <?php the_post_thumbnail( 'dazzling-featured', array( 'class' => 'thumbnail' )); ?>

    With this one:
    <?php the_post_thumbnail( 'dazzling-featured', array( 'class' => 'thumbnail wplightbox' )); ?>

    You can see that this modification includes class you mentioned, so it lightbox should recognize. Some plugins might target only post content and featured images might not count even when apply the right class and it still won’t work. But not sure about this plugin.

    Thread Starter anoukgo

    (@anoukgo)

    hi.
    yes I did this, the image got the right class..
    but I had to add a link that lead to image source, to show the image as popup.
    anyway after research I did it like this:

    <a class="wplightbox" href="<?php echo $image_url ?>"><?php the_post_thumbnail( 'medium' ); ?></a>

    <?php
    $image_id = get_post_thumbnail_id();
    $image_url = wp_get_attachment_image_src($image_id,'large');
    $image_url = $image_url[0];
    ?>

    and it works now. 🙂

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘featured image popup’ is closed to new replies.