Wordpress - Add lightbox to feature image

File single-<name>.php or single.php

change:

<?php
                if(has_post_thumbnail())  {

                    the_post_thumbnail(
                        array($theme->get_option('featured_image_width_single'), $theme->get_option('featured_image_height_single')),
                        array("class" => $theme->get_option('featured_image_position_single') . " featured_image")
                    ); };
?>

to:


<a rel="lightbox" href="<?php $image_id = get_post_thumbnail_id();
                        $image_url = wp_get_attachment_image_src($image_id,'thumb-medium', true);
                        echo $image_url[0];  ?>">
                        <?php the_post_thumbnail(
                        array($theme->get_option('featured_image_width_single'), $theme->get_option('featured_image_height_single')),
                        array("class" => $theme->get_option('featured_image_position_single') . " featured_image" )
                    ); }; ?>
 </a>

Post a Comment