Full-screen slideshow in WordPress
A slideshow that fills the whole screen, browsed with the keyboard or a finger swipe, and closed with Escape.
Here is an excerpt of this component's code in WordPress. The full code is free for members, ready to copy into your project.
This component also comes in
The code in WordPress
<?php
/**
* Plugin Name: Forge, Diaporama plein écran
* Description: Un diaporama qui occupe tout l’écran, se parcourt au clavier ou d’un balayage du doigt et se ferme avec Échap. Ajoute la composition « Diaporama plein écran » à l'éditeur de blocs.
* Version: 1.0.0
* Requires at least: 6.6
* Requires PHP: 8.1
* Author: Forge
* License: GPL-2.0-or-later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: forge-galerie-plein-ecran-diaporama
*<!-- wp:html -->
<section class="gpe" data-gpe aria-labelledby="gpe-titre">
<div class="gpe-cover" role="img" aria-label="Le moulin et sa roue à aubes, vus depuis le pont" style="--gpe-bg: radial-gradient(circle at 30% 55%, transparent 0 14%, #5a3e2b 15% 17%, transparent 18%), linear-gradient(180deg, #bcd9e8 0 45%, #d8c8ad 45% 70%, #5f8aa0 70%)"></div>
<div class="gpe-body">
<p class="gpe-eyebrow">Gîte du Moulin · Dordogne</p>
<h2 class="gpe-title" id="gpe-titre">Visitez le gîte en photos</h2>
<p class="gpe-lead">Six pièces et extérieurs, à parcourir en plein écran au clavier ou d’un geste du doigt.</p>
<button class="gpe-start" type="button" data-gpe-start><svg class="gpe-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5"/></svg> Voir les 6 photos en plein écran</button>
</div>
<ul hidden>
<li data-gpe-slide data-gpe-alt="Le moulin et sa roue à aubes, vus depuis le pont" style="--gpe-bg: radial-gradient(circle at 30% 55%, transparent 0 14%, #5a3e2b 15% 17%, transparent 18%), linear-gradient(180deg, #bcd9e8 0 45%, #d8c8ad 45% 70%, #5f8aa0 70%)"></li>
<li data-gpe-slide data-gpe-alt="Le séjour et sa cheminée en pierre" style="--gpe-bg: radial-gradient(ellipse 18% 14% at 50% 70%, #f59e0b 0 50%, #1f1a17 52% 95%, transparent), linear-gradient(180deg, #e8dfd0 0 75%, #8b6b4a 75%)"></li>(() => {
if (!document.querySelector(".gpe")) return;
document.querySelectorAll("[data-gpe]").forEach((root) => {
const on = (el, type, fn) => el.addEventListener(type, fn);
const dialog = root.querySelector("[data-gpe-dialog]");
const photo = root.querySelector("[data-gpe-photo]");
const caption = root.querySelector("[data-gpe-caption]");
const start = root.querySelector("[data-gpe-start]");
const slides = Array.from(root.querySelectorAll("[data-gpe-slide]"));
let index = 0;
let downX = null;
:root {
--gpe-card: #ffffff;
--gpe-text: #1f2a1f;
--gpe-muted: #556355;
--gpe-accent: #3f6212;
--gpe-on-accent: #ffffff;
--demo-galerie-plein-ecran-diaporama-bg: #eaefe6;
--demo-galerie-plein-ecran-diaporama-text: #1f2a1f;
}
@media (prefers-color-scheme: dark) {
:root.forge-follows-system:not([data-theme="light"]) {Free component: copy it freely, including for commercial projects.
Other galleries and carousels components in WordPress
Galleries and carousels components in WordPress
A product photo that zooms in under the pointer, and from the keyboard with Enter and the arrow keys, to inspect the details.
- Tailwind
- React
- CSS
- WordPress

An Instagram-style square grid with a profile header and captions on hover, served by your own site: no social network script or cookie.
- Tailwind
- React
- CSS
- WordPress

Building site photos sorted by dated step on a vertical timeline, with the current step highlighted.
- Tailwind
- React
- CSS
- WordPress

A large photo with clickable thumbnails and arrows, for a product page or a property listing.
- Tailwind
- React
- CSS
- WordPress

YouTube videos shown as thumbnails: the player only loads on click, to respect privacy and keep the page light.
- Tailwind
- React
- CSS
- WordPress

Projects sorted by type of work, arranged in tabs that work with the keyboard and screen readers.
- Tailwind
- React
- CSS
- WordPress