Notice: These forums are now retired and closed. For active support, please Submit a Ticket or visit our official WordPress.org community pages.
Kadence Theme | Kadence Blocks | Starter Templates | WooCommerce Email Designer | Ascend | Virtue | Pinnacle

Lightbox in new template

Home / Forums / Virtue Theme / Lightbox in new template

This topic is: Resolved
[Resolved]
Posted in: Virtue Theme
March 14, 2015 at 11:17 am

Hi Ben,

I created a new template called “single-attachment.php”, how do I add lightbox to my images so they open up in a light box?

Template code:

<?php if (wp_attachment_is_image($post->id)) {
$att_image = wp_get_attachment_image_src( $post->id, "full");
?>
<p class="attachment">
<a href="<?php echo wp_get_attachment_url($post->id); ?>" rel="ligtbox" title="<?php the_title(); ?>">
<img src="<?php echo $att_image[0];?>" width="<?php echo $att_image[1];?>" height="<?php echo $att_image[2];?>" class="attachment-medium" alt="<?php $post->post_excerpt; ?>" />
</a>
</p>
<?php } ?>

Thanks,
Emre

  • The forum ‘Virtue Theme’ is closed to new topics and replies.