Skip to content

Social-style photo grid without third-party scripts in 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.

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

Open in a new tab

The code in WordPress

galerie-instagram-statique.php
<?php
/**
 * Plugin Name: Forge, Galerie façon réseau social, sans script tiers
 * Description: Une grille carrée façon Instagram avec en-tête de profil et légendes au survol, servie par votre site : aucun script ni cookie de réseau social. Ajoute la composition « Galerie façon réseau social, sans script tiers » à 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-instagram-statique
 *
pattern.html
<!-- wp:html -->
<section class="gis" data-gis aria-labelledby="gis-titre">
        <header class="gis-head">
          <div class="gis-avatar" aria-hidden="true">TL</div>
          <div class="gis-who">
            <h2 class="gis-title" id="gis-titre">Terre de Loire</h2>
            <p class="gis-handle">Atelier de céramique à Saumur · cours et ventes</p>
            <ul class="gis-stats" role="list">
              <li><strong>9</strong> publications</li>
              <li><strong>1 640</strong> abonnés</li>
            </ul>
          </div>
script.js
(() => {
  if (!document.querySelector(".gis")) return;
  document.querySelectorAll("[data-gis]").forEach((root) => {
    const on = (el, type, fn) => el.addEventListener(type, fn);
    const toggle = root.querySelector("[data-gis-toggle]");
    on(toggle, "click", () => {
      const show = toggle.getAttribute("aria-pressed") !== "true";
      toggle.setAttribute("aria-pressed", String(show));
      toggle.textContent = show ? "Masquer les légendes" : "Afficher les légendes";
      root.toggleAttribute("data-gis-captions", show);
    });
  });
style.css
:root {
  --gis-card: #ffffff;
  --gis-text: #292524;
  --gis-muted: #57534e;
  --gis-accent: #9a3412;
  --gis-line: #e7e5e4;
  --demo-galerie-instagram-statique-bg: #f5f1ea;
  --demo-galerie-instagram-statique-text: #292524;
}

@media (prefers-color-scheme: dark) {
  :root.forge-follows-system:not([data-theme="light"]) {

Free component: copy it freely, including for commercial projects.

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
    Component
  • Building site photos sorted by dated step on a vertical timeline, with the current step highlighted.

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

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A slideshow that fills the whole screen, browsed with the keyboard or a finger swipe, and closed with Escape.

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

    • Tailwind
    • React
    • CSS
    • WordPress
    Component