Description
WordPress ships with a native Lightbox-Effect for image blocks. This plugin adds one tiny additional option to the core image and gallery blocks: Show Caption.
When the toggle is enabled, the native lightbox receives the current image alt text as a data-img-alt attribute on the enlarged lightbox figure. A small frontend CSS then displays that value as a caption overlay inside the lightbox image.
Please note: The caption text is taken from the image alt attribute.
The toggle is only available when the native Lightbox-Effect is active. If the lightbox is disabled or the image is linked somewhere else, the caption option is disabled as well.
Plugin Features
✔ adds a new toggle Show caption to the core Image block
✔ adds the same toggle to the core Gallery block
✔ the toggle can only be enabled when the native Lightbox-Effect is active
✔ ships with German translation files for the editor toggle
✔ uses the image alt attribute as value for data-img-alt
✔ adds the attribute only to the enlarged image figure in the lightbox
✔ supports galleries by passing the gallery setting to the nested image blocks
✔ outputs the value with a lightweight frontend CSS pseudo element
✔ uses no new block and does not replace the existing Image or Gallery blocks
Installation
- Upload the plugin files to the
/wp-content/plugins/lmdm-lightbox-image-captiondirectory, or install the plugin through the WordPress plugins screen directly. - Activate the plugin through the Plugins screen in WordPress.
- Open a post or page in the block editor.
- Add or select an Image or Gallery block.
- Enable the native Lightbox-Effect first.
- Enable
Show captionin the Lightbox panel.
FAQ
-
Does it create a new block?
-
No, it only extends the existing core Image and Gallery blocks.
-
Does it use the normal image caption field?
-
No. It uses the image
altattribute and writes it todata-img-altin the native lightbox overlay. -
Why is the toggle disabled?
-
The toggle is only active when the native WordPress Lightbox-Effect is enabled. If the image links to a media file, attachment page or custom URL, the native lightbox is not active and the option is disabled.
-
Does it work with galleries?
-
Yes. Enable the native Lightbox-Effect for the gallery first and then enable
Show caption. The setting is passed to the gallery images when the block is rendered. -
Does it load any additional assets in the frontend?
-
Yes, it loads one small CSS file that displays the
data-img-altvalue as a pseudo element in the native lightbox overlay. -
What happens when i disable the plugin?
-
The additional toggle and frontend caption output disappear. Existing Image and Gallery blocks continue to work as normal core blocks.
-
The WordPress-User “nicmare” vibe coded it. Means he had the idea of the plugin and uses AI to craft the code.
Reviews
There are no reviews for this plugin.
Contributors & Developers
“LMDM Lightbox Image Caption” is open source software. The following people have contributed to this plugin.
ContributorsTranslate “LMDM Lightbox Image Caption” into your language.
Interested in development?
Browse the code, check out the SVN repository, or subscribe to the development log by RSS.
Changelog
1.0.0
- first release of the plugin
- added German translation files for the editor toggle