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

Mô tả

This WordPress Plugin adds a simple & lightweight Lightbox to the standard WordPress Image Gallery Block. It detects if a post contains a Gallery Block and then loads & initializea 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 to → Media 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.

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 Image Block (Default Block)
  • Gallery (Default Classic Editor Gallery)
  • CoBlocks Gallery Collage / Masonry / Offset / Stacked

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

Ảnh màn hình

  • Simple, modern and minimalistic Lightbox for your Gallery Block
  • Set Link to to Media File on your Gallery Block

Cài đặt

  1. Upload the folder gallery-block-lightbox to the /wp-content/plugins/ directory
  2. Activate the plugin through the ‘Plugins’ menu in WordPress
  3. Add a Gallery or Image Block to your Post and set Link toMedia File
  4. Check your Gallery or Image with Lightbox on the front end by clicking on an image

Hỏi đáp

When I click on an image, nothing happens

Check if you used the built in Gallery Block and if Link to is set to Media File in the Block sidebar. On an Image Block choose Add Link at the Toolbar.

If you would like to have this as a default behaviour go to yourblog.com/wp-admin/options.php and search for image_default_link_type. Set the value to file and hit save. This will apply to all new Image & Gallery Blocks.

Does it work for single images?

Yes! Just set the Link at the Toolbar to Media File

Can I deactivate the Lightbox for a Gallery?

Set Media File to None or remove the Link.

Đánh giá

12 Tháng Bảy, 2021
perfect: download, activate, works - what more could you want. And lightweight at the same time. Works fantastically with the Gallery Block and Image Block
30 Tháng Sáu, 2021
I needed a solution without JQuery that was simple to set up, this worked a dream and even when i experienced an issue the developer was quick to fix it!
24 Tháng Sáu, 2021
Its excellent and just works. And the support from Johannes to my query was fast and spot-on with a new plugin update to sort the issue released the next day.
15 Tháng Sáu, 2021
Installed & activated, it DIDN'T work like magic but it was my own fault because I didn't RTFM. My gallery block was set to "link to: None", but once I set it to "link to: Media" I was all set! Would love some additional customization options in the future (color/opacity of the overlay, for starters), but that's not worth taking any stars off when it does what it says on the box and works with the native blocks. Thanks!
Đọc tất cả 34 đánh giá

Người đóng góp & Lập trình viên

“Lightbox for the Default Gallery & Image Block (Simple, Lightweight & No Lock In)” là mã nguồn mở. Những người sau đã đóng góp vào plugin này.

Những người đóng góp

“Lightbox for the Default Gallery & Image Block (Simple, Lightweight & No Lock In)” đã được dịch qua 2 ngôn ngữ. Cảm ơn những người tham gia dịch vì đóng góp của họ.

Dịch “Lightbox for the Default Gallery & Image Block (Simple, Lightweight & No Lock In)” sang ngôn ngữ của bạn.

Muốn tham gia phát triển?

Duyệt code, check out SVN repository, hoặc theo dõi nhật ký phát triển qua RSS.

Nhật ký thay đổi

Hint: With WordPress 5.6 you can set the default behaviour for Link to. Go to yourblog.com/wp-admin/options.php and search for image_default_link_type. Set the value to file and hit save. This will apply to all new Image & Gallery Blocks.

1.8.5

  • Fix Caption for the single Image Block

1.8.4

  • Add Caption Support for the Classic Editor Gallery

1.8.3

  • Fix Regex Filter

1.8.2

  • Add support for file links with query parameter at the end

1.8.1

  • Fix image link filter

1.8.0

  • Add support for .avif, .heif/.heic, .tif

1.7.0

  • Add support for Media and Text Block

1.6.0

  • Add support for CoBlocks Gallery Collage / Masonry / Offset / Stacked

1.5.0

  • Add support for Classic Editor Gallery

1.4.0

  • Add support for .svg images

1.3.1

  • Remove trailing slash from register_script/style

1.3.0

  • Support for the default Image Block

1.2.0

  • Support HTML for the Caption

1.0.0

First release