Title: Automatic lightbox plugin
Last modified: October 6, 2021

---

# Automatic lightbox plugin

 *  Resolved [Master_Yi](https://wordpress.org/support/users/master_yi/)
 * (@master_yi)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/automatic-lightbox-plugin/)
 * I am hosting an image-based website and need a plugin to simply add lightboxes
   to all post’s images. All plugins I found so far require that the image is within
   a link tag or a gallery, which is not an option, since there are already thousands
   of posts that would require changes in order for this to happen.
 * Is there anything that simply works off an image tag?
    -  This topic was modified 4 years, 9 months ago by [Jan Dembowski](https://wordpress.org/support/users/jdembowski/).
      Reason: Moved to Fixing WordPress, this is not an Everything else WordPress
      topic

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

 *  Moderator [Steven Stern (sterndata)](https://wordpress.org/support/users/sterndata/)
 * (@sterndata)
 * Volunteer Forum Moderator
 * [4 years, 9 months ago](https://wordpress.org/support/topic/automatic-lightbox-plugin/#post-14941074)
 * Have you tried “Simple Lightbox”? [https://wordpress.org/plugins/search/lightbox](https://wordpress.org/plugins/search/lightbox)
 *  Thread Starter [Master_Yi](https://wordpress.org/support/users/master_yi/)
 * (@master_yi)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/automatic-lightbox-plugin/#post-14941124)
 * Hi, thank you. Yes, I’ve tried. And unless I’ve missed something it seems like
   it requires that I setup a link to an image rather than simply building the lightbox
   from the images.
 *  [hiyottaunits](https://wordpress.org/support/users/hiyottaunits/)
 * (@hiyottaunits)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/automatic-lightbox-plugin/#post-14942787)
 * Hi [@master_yi](https://wordpress.org/support/users/master_yi/) – If using Lightbox(
   [https://lokeshdhakar.com/projects/lightbox2](https://lokeshdhakar.com/projects/lightbox2)),
   you only need to add data-lightbox attribute to all images. You can insert JavaScript
   like this to do this.
 *     ```
       let images = document.querySelector('a.img');
       images.forEach((image, index) => {
         let imageIndex = 'img-' + index;
         image.setAttribute('data-lightbox', imageIndex);
       }); 
       ```
   
 *  Thread Starter [Master_Yi](https://wordpress.org/support/users/master_yi/)
 * (@master_yi)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/automatic-lightbox-plugin/#post-14943099)
 * [@hiyottaunits](https://wordpress.org/support/users/hiyottaunits/) ooo. I didn’t
   think about this option. This is perfect, thank you!

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

The topic ‘Automatic lightbox plugin’ is closed to new replies.

## Tags

 * [dashboard](https://wordpress.org/support/topic-tag/dashboard/)
 * [missing page](https://wordpress.org/support/topic-tag/missing-page/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 4 participants
 * Last reply from: [Master_Yi](https://wordpress.org/support/users/master_yi/)
 * Last activity: [4 years, 9 months ago](https://wordpress.org/support/topic/automatic-lightbox-plugin/#post-14943099)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
