Title: Lightbox for Gallery &amp; Image Block
Author: Johannes Kinast
Published: <strong>4 juin 2020</strong>
Last modified: 29 janvier 2026

---

Recherche d’extensions

![](https://ps.w.org/gallery-block-lightbox/assets/icon.svg?rev=2788519)

# Lightbox for Gallery & Image Block

 Par [Johannes Kinast](https://profiles.wordpress.org/goaroundagain/)

[Télécharger](https://downloads.wordpress.org/plugin/gallery-block-lightbox.zip)

 * [Détails](https://fr.wordpress.org/plugins/gallery-block-lightbox/#description)
 * [Avis](https://fr.wordpress.org/plugins/gallery-block-lightbox/#reviews)
 *  [Installation](https://fr.wordpress.org/plugins/gallery-block-lightbox/#installation)
 * [Développement](https://fr.wordpress.org/plugins/gallery-block-lightbox/#developers)

 [Support](https://wordpress.org/support/plugin/gallery-block-lightbox/)

## Description

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](https://github.com/feimosi/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_  _Link
to image file_ or _Link images to media file_ (see screenshots below) for all of
your Image & Gallery Blocks to work properly. If you choose _None_ or _Link to attachment
page_ it will not work. But that’s fine if you don’t want the Lightbox for a specific
Image or Gallery.

Consultez la [vidéo YouTube de Jakson](https://youtu.be/qfLOH22cUNM) où il donne
son avis sur cette extension :

### Fonctionnalités

Voici les caractéristiques de baguetteBox.js :

 * Écrit en pur JavaScript
 * Aucune dépendance (p. ex. jQuery)
 * Image captions support
 * Responsive
 * Prise en charge des gestes de balayage
 * Environ 13 Ko, 7 Ko compressé

### Compatible avec

 * Bloc galerie (Bloc par défaut)
 * Bloc image (Bloc par défaut)
 * Bloc média et texte (Bloc par défaut)
 * Galerie (Galerie par défaut de l’éditeur classique)
 * Blocs galeries Coblocks Collage / Masonry / Offset / Stacked
 * Meow Gallery (+ Gallery Block)

N’oubliez pas de sélectionner Lien vers  Fichier média pour que toutes vos galeries
et images fonctionnent correctement.

**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_ –> _Comment mettre en file d‘attente les ressources nécessaires(
script et style) pour les blocs en dehors des publications ou pour les types de 
blocs qui ne sont pas pris en charge par défaut ?_

## Captures d’écrans

 * [[
 * Visionneuse simple, moderne et minimaliste pour votre bloc Galerie.
 * [[
 * Set _Link_ to _Link to image file_ on your Image Block
 * [[
 * Set _Link_ to _Link images to media file_ on your Gallery Block

## Installation

 1. Upload the folder `gallery-block-lightbox` to the `/wp-content/plugins/` directory
 2. Activez l’extension via le menu « Extensions » de WordPress.
 3. Add a Gallery or Image Block to your Post and set _Link to_  _Media File_
 4. Check your Gallery or Image with Lightbox on the front end by clicking on an image

## FAQ

### Lorsque je clique sur une image, rien ne se passe.

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_.

### Fonctionne-t-il pour les images uniques ?

Yes! Just set the Link at the _Toolbar_ to _Media File_

### Can I deactivate the Lightbox for a single Image or Gallery?

Set _Media File_ to _None_ or remove the Link.

### Is there a way to set the default Link to option to Media File?

Since WordPress 5.6 you can now set the default behavior 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.

Or you can add the follow snipped (WordPress 5.7+ / PHP 7.4+) to your functions.
php:
 `add_filter( 'option_image_default_link_type', fn () => 'file' );`

### Comment puis-je ajouter mon propre bloc ? / Comment puis-je modifier le sélecteur CSS ?

You can change the CSS selector to a gallery (or galleries) containing `<a>` tags
used by [baguetteBox.js](https://github.com/feimosi/baguetteBox.js#api) with the`
baguettebox_selector` filter:
 `add_filter( 'baguettebox_selector', function( $selector){
return $selector . ',.my-gallery'; } )` You can override the full selector by just
returing your selector e.g. to show all images in your post in one lightbox (not
per Gallery/Image Block): `add_filter( 'baguettebox_selector', function() { return'.
entry-content'; } )`

### Comment mettre en file d‘attente les ressources nécessaires (script et style) pour les blocs en dehors des publications ou pour les types de blocs qui ne sont pas pris en charge par défaut ?

Si vous utilisez un bloc Galerie ou Image en dehors d‘une publication, par exemple
à l‘intérieur d‘un widget, et souhaitez appliquer la visionneuse, vous devez vous
assurer que les ressources nécessaires de baguettebox (script et style) sont mises
en file d‘attente à l‘aide du filtre baguettebox_enqueue_assets.

If the Widget is on every page or the majority of pages, you can just enqueue the
baguettebox assets everywhere. Just add the following snippet to `functions.php`:
`
add_filter( 'baguettebox_enqueue_assets', '__return_true' );` If your Widget is 
just at the front page, use `is_front_page()`: `add_filter( 'baguettebox_enqueue_assets',
function( $enqueue_assets ) { return is_front_page(); } );` If you want to use the
Gallery & Image Block Lightbox plugin with a block type that is not supported by
default, you can make use of the `has_block()` function. For instance, in the case
of the Kadence Blocks Advanced Gallery, use: `add_filter( 'baguettebox_enqueue_assets',
function ( $enqueue_assets ) { return $enqueue_assets || has_block( 'kadence/advancedgallery');});
Of course, in the previous example you also have to add the appropriate baguettebox
selector, i.e. add_filter( 'baguettebox_selector', function( $selector ) { return
$selector . ',.wp-block-kadence-advancedgallery'; } );

### Puis-je modifier ou désactiver l‘animation lors des transitions d‘images ?

By default, baguetteBox.js shows a slide-in animation on image transitions. You 
can change it to the following filter to `'fadeIn'`:
 `add_filter( 'baguettebox_animation',
function () { return 'fadeIn'; } );` Or disable the animation completely with `'
false'`: `add_filter( 'baguettebox_animation', function () { return 'false'; } );`

### Can I exclude single images from applying the lightbox?

You can remove the link from the image or add the CSS class `no-lightbox` to the
image link. Not to the image directly; you have to add the class to the link.

## Avis

![](https://secure.gravatar.com/avatar/0bf5620cb98748d66a6bbb48a7d5cb223dfaeea60e397afd06d2da4d5c3e48e4?
s=60&d=retro&r=g)

### 󠀁[Super simple and works perfect](https://wordpress.org/support/topic/super-simple-and-works-perfect/)󠁿

 [zwex](https://profiles.wordpress.org/zwex/) 19 novembre 2025

Thank you!

![](https://secure.gravatar.com/avatar/dc8c396abd988c10c22a9a639f3dfe8b385f9b065df4f2ea0b65e6314e9697a6?
s=60&d=retro&r=g)

### 󠀁[Simple & Fast](https://wordpress.org/support/topic/simple-fast-19/)󠁿

 [teelanovela](https://profiles.wordpress.org/teelanovela/) 28 octobre 2025

just what i needed. no bloat. just works (TM)

![](https://secure.gravatar.com/avatar/83d1cf2d97b0f415dcd0983fecb118d6e0cab784460c4845717a104203134f7e?
s=60&d=retro&r=g)

### 󠀁[Супер!](https://wordpress.org/support/topic/%d1%81%d1%83%d0%bf%d0%b5%d1%80-193/)󠁿

 [Peter Levchenko](https://profiles.wordpress.org/plevchenko/) 19 septembre 2025

Як же довго шукав такий плагін. Оцінка 5. Плагін робочий і без зайвого барахла (
реклама, про версія). Дуже дякую!

![](https://secure.gravatar.com/avatar/8881eaec56d34f625e0e11f201e055bf64b2ea7247b1e094aa0f29153042fa0d?
s=60&d=retro&r=g)

### 󠀁[Simple and works](https://wordpress.org/support/topic/simple-and-works-239/)󠁿

 [human02d](https://profiles.wordpress.org/human02d/) 21 août 2025

Thanks for your great work. Good plugin, exactly what i was looking for. It follows
the KISS principle. Keep It Simple, Stupid!

![](https://secure.gravatar.com/avatar/ddd9be8061b65d73ca9d2dfeab415b740e47cc5a1c0c99958ef9c6d7b8ce0586?
s=60&d=retro&r=g)

### 󠀁[Simple & Clever](https://wordpress.org/support/topic/simple-and-clever-5/)󠁿

 [dida110](https://profiles.wordpress.org/dida110/) 2 août 2025

I tested more than five plugins, and this is the first free one that’s exactly how
I would have programmed it. Thank you so much!

![](https://secure.gravatar.com/avatar/6211a7e11ffeb1e9ca3b1bb6a958bfd0fe0a8537cbb95268e18273460dc6c100?
s=60&d=retro&r=g)

### 󠀁[What I was looking for!](https://wordpress.org/support/topic/what-i-was-looking-for-73/)󠁿

 [enevevet](https://profiles.wordpress.org/enevevet/) 15 avril 2025

Lightweight, not tons of settings, responsive, you can zoom in on mobiles, nice 
style, works with native Guthenberg blocks, simple tutorial. That’s perfect. Thank
you a lot for all your efforts to maintain this project. It’s really appreciated!

 [ Lire les 88 avis ](https://wordpress.org/support/plugin/gallery-block-lightbox/reviews/)

## Contributeurs/contributrices & développeurs/développeuses

« Lightbox for Gallery & Image Block » est un logiciel libre. Les personnes suivantes
ont contribué à cette extension.

Contributeurs

 *   [ Johannes Kinast ](https://profiles.wordpress.org/goaroundagain/)

“Lightbox for Gallery & Image Block” a été traduit dans 9 locales. Remerciez [l’équipe de traduction](https://translate.wordpress.org/projects/wp-plugins/gallery-block-lightbox/contributors)
pour ses contributions.

[Traduisez « Lightbox for Gallery & Image Block » dans votre langue.](https://translate.wordpress.org/projects/wp-plugins/gallery-block-lightbox)

### Le développement vous intéresse ?

[Parcourir le code](https://plugins.trac.wordpress.org/browser/gallery-block-lightbox/),
consulter le [SVN dépôt](https://plugins.svn.wordpress.org/gallery-block-lightbox/),
ou s’inscrire au [journal de développement](https://plugins.trac.wordpress.org/log/gallery-block-lightbox/)
par [RSS](https://plugins.trac.wordpress.org/log/gallery-block-lightbox/?limit=100&mode=stop_on_copy&format=rss).

## Journal des modifications

### 1.16.1

 * No changes, just a version fix.

### 1.16

 * Add filter baguettebox_animation to choose between ‘slideIn’ | ‘fadeIn’ | ‘false’
   animation styles on image transitions.

### 1.15

 * Add filter baguettebox_captions to change the JavaScript function to get the 
   caption of an image

### 1.14

 * Add the CSS class `.no-lightbox`

### 1.13

 * Support GenerateBlocks Image

### 1.12

 * Support Meow Gallery (+ Gallery Block)

### 1.11

 * Add filter baguettebox_enqueue_assets to control enqueing of baguettebox assets.

### 1.10.1

 * Fix Image in Media & Text Block

### 1.10.0

 * Add two Filter baguettebox_selector for the baguetteBox.js CSS selector and baguettebox_filter
   for the baguetteBox.js file type RegExp filter

### 1.9.0

 * Support new Gallery Block format (will be released with WordPress 5.9 in December
   2021) https://make.wordpress.org/core/2021/08/20/gallery-block-refactor-dev-note/

### 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

 * Ajout de la prise en charge des images .svg

### 1.3.1

 * Remove trailing slash from register_script/style

### 1.3.0

 * Prise en charge du bloc d’image par défaut

### 1.2.0

 * Prise en charge de l‘HTML pour la légende

### 1.0.0

Première version

## Méta

 *  Version **1.16.1**
 *  Dernière mise à jour **il y a 2 mois**
 *  Installations actives **20 000+**
 *  Version de WordPress ** 5.4 ou plus **
 *  Testé jusqu’à **6.9.4**
 *  Version de PHP ** 5.3 ou plus **
 *  Langues
 * [Dutch](https://nl.wordpress.org/plugins/gallery-block-lightbox/), [English (US)](https://wordpress.org/plugins/gallery-block-lightbox/),
   [French (France)](https://fr.wordpress.org/plugins/gallery-block-lightbox/), 
   [German](https://de.wordpress.org/plugins/gallery-block-lightbox/), [Italian](https://it.wordpress.org/plugins/gallery-block-lightbox/),
   [Japanese](https://ja.wordpress.org/plugins/gallery-block-lightbox/), [Russian](https://ru.wordpress.org/plugins/gallery-block-lightbox/),
   [Spanish (Chile)](https://cl.wordpress.org/plugins/gallery-block-lightbox/), 
   [Spanish (Spain)](https://es.wordpress.org/plugins/gallery-block-lightbox/), 
   et [Swedish](https://sv.wordpress.org/plugins/gallery-block-lightbox/).
 *  [Traduisez la dans votre langue](https://translate.wordpress.org/projects/wp-plugins/gallery-block-lightbox)
 * Étiquettes
 * [block](https://fr.wordpress.org/plugins/tags/block/)[block-editor](https://fr.wordpress.org/plugins/tags/block-editor/)
   [gallery](https://fr.wordpress.org/plugins/tags/gallery/)[image](https://fr.wordpress.org/plugins/tags/image/)
   [lightbox](https://fr.wordpress.org/plugins/tags/lightbox/)
 *  [Vue avancée](https://fr.wordpress.org/plugins/gallery-block-lightbox/advanced/)

## Évaluations

 5 sur 5 étoiles.

 *  [  87 avis à 5 étoiles     ](https://wordpress.org/support/plugin/gallery-block-lightbox/reviews/?filter=5)
 *  [  1 avis à 4 étoile     ](https://wordpress.org/support/plugin/gallery-block-lightbox/reviews/?filter=4)
 *  [  0 avis à 3 étoile     ](https://wordpress.org/support/plugin/gallery-block-lightbox/reviews/?filter=3)
 *  [  0 avis à 2 étoile     ](https://wordpress.org/support/plugin/gallery-block-lightbox/reviews/?filter=2)
 *  [  0 avis à 1 étoile     ](https://wordpress.org/support/plugin/gallery-block-lightbox/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/gallery-block-lightbox/reviews/#new-post)

[Voir tous les avis](https://wordpress.org/support/plugin/gallery-block-lightbox/reviews/)

## Contributeurs

 *   [ Johannes Kinast ](https://profiles.wordpress.org/goaroundagain/)

## Support

Quelque chose à dire ? Besoin d’aide ?

 [Voir le forum de support](https://wordpress.org/support/plugin/gallery-block-lightbox/)