Lightbox for the Default Gallery & Image Block (Simple, Lightweight & No Lock In)

Adds a simple & lightweight Lightbox to the standard WordPress Gallery & Image Block. No…

Author:Johannes Kinast (profile at wordpress.org)
WordPress version required:5.4
WordPress version tested:6.5.2
Plugin version:1.13
Added to WordPress repository:04-06-2020
Last updated:12-04-2024
Rating, %:100
Rated by:78
Plugin URI:
Total downloads:92 125
Active installs:10 000+
plugin download
Click to start download

This WordPress Plugin adds a simple & lightweight Lightbox to the standard WordPress Gallery & Image Block. It detects if a post contains a Gallery or Image Block and then loads & initialize baguetteBox.js, a pure JavaScript Lightbox script without any dependencies and a modern minimal look.

There is no lock in effect. It does not add a new Block Editor/Gutenberg Block and relies solo on the standard WordPress Gallery and Image Block. You can deactivate this plugin at any time and your Gallery and Image Blocks will work as they’ve done before. Just without the lightbox.

Just one important thing to remember: You always have to select Link toMedia File for all of your Galleries & Images to work properly. If you choose None or Attachment Page it will not work. But that’s fine if you don’t want the Lightbox for a specific Image or Gallery.

Features

Here are the features of baguetteBox.js:

  • Written in pure JavaScript
  • No dependencies (e.g. jQuery)
  • Image captions support
  • Responsive
  • Supports swipe gestures
  • Around 13 KB, 7 KB gzipped

Works with

  • Gallery Block (Default Block)
  • Image Block (Default Block)
  • Media and Text Block (Default Block)
  • Gallery (Default Classic Editor Gallery)
  • CoBlocks Gallery Collage / Masonry / Offset / Stacked
  • Meow Gallery (+ Gallery Block)
  • GenerateBlocks Image (Set Enable Dynamic DataLink source to Single image)

Don’t forget to select Link to → Media File for all of your Galleries & Images to work properly.

Notice: At the moment, just Blocks inside a post are supported. Not Blocks in a Widget. You can make it work but have to enqueue the necessary style & script yourself. See FAQ –> How to enqueue the necessary assets (script & style) for blocks outside of posts or for block types that are not supported by default?


Screenshots
FAQ
ChangeLog