Skip to content

Sitemap accordion footer in WordPress

A dark footer with brand, social links and a four-column sitemap that turns into collapsible sections on mobile.

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

footer-plan-accordeon.php
<?php
/**
 * Plugin Name: Forge, Footer plan du site en accordéon
 * Description: Un pied de page sombre avec marque, réseaux sociaux et plan du site en quatre colonnes, qui deviennent des sections repliables sur mobile. Ajoute la composition « Footer plan du site en accordéon » à 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-footer-plan-accordeon
 *
pattern.html
<!-- wp:html -->
<footer class="fmap" data-fmap>
        <div class="fmap__top">
          <div class="fmap__brand">
            <p class="fmap__logo"><span class="fmap__mark" aria-hidden="true"></span>Maison Lune</p>
            <p class="fmap__pitch">Bougies coulées à la main à Lille, en cire de colza et parfums de Grasse.</p>
            <ul class="fmap__socials">
              <li><a class="fmap__social" href="#instagram" aria-label="Instagram"><svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3.5" y="3.5" width="17" height="17" rx="5"/><circle cx="12" cy="12" r="4"/><circle cx="17.2" cy="6.8" r="0.6"/></svg></a></li>
              <li><a class="fmap__social" href="#facebook" aria-label="Facebook"><svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="8.5"/><path d="M13 20.5v-7h2.4l.4-2.8H13V9.2c0-.8.3-1.3 1.4-1.3H16V5.4a17 17 0 0 0-2.1-.1c-2 0-3.4 1.2-3.4 3.5v1.9H8.3v2.8h2.2v7"/></svg></a></li>
              <li><a class="fmap__social" href="#pinterest" aria-label="Pinterest"><svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="8.5"/><path d="M10.5 20.2 12 14m0 0c.4 1 1.3 1.5 2.4 1.5 2.2 0 3.6-2.1 3.6-4.6 0-2.8-2.3-4.6-5.4-4.6-3.4 0-5.4 2.3-5.4 4.8 0 1.2.5 2.4 1.4 2.8M12 14l1.1-4.2"/></svg></a></li>
            </ul>
          </div>
script.js
(() => {
  if (!document.querySelector(".fmap")) return;
  document.querySelectorAll("[data-fmap]").forEach((footer) => {
    // Lists only collapse on small screens: the CSS ignores data-collapsed above 640px.
    footer.querySelectorAll("[data-fmap-toggle]").forEach((button) => {
      const list = document.getElementById(button.getAttribute("aria-controls"));
      button.addEventListener("click", () => {
        const open = button.getAttribute("aria-expanded") === "true";
        button.setAttribute("aria-expanded", String(!open));
        list.toggleAttribute("data-collapsed", open);
      });
      list.setAttribute("data-collapsed", "");
style.css
:root {
  --fmap-bg: #0b0b0f;
  --fmap-ring-color: transparent;
  --fmap-text: #f4f4f5;
  --fmap-link: #d4d4d8;
  --fmap-muted: #a1a1aa;
  --fmap-line: #27272a;
  --fmap-border: #3f3f46;
  --fmap-accent: #fbbf24;
  --demo-footer-plan-accordeon-bg: #e4e4e7;
  --demo-footer-plan-accordeon-text: #0b0b0f;
}

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

Footers components in WordPress
  • A complete footer (introduction, contact details, sitemap, legal links) where the Made with Forge link is a standalone paragraph: keep it or delete it, the layout stays the same.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A footer for building tradespeople: contact details and a call button, service area with the towns covered, opening hours, then the details a French professional must display (SIRET, VAT number, registration, ten-year liability insurance with insurer and coverage, consumer mediator) and the legal links.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • Cards linking to each social network with the reason to follow, for clubs and associations.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A highlighted invitation to subscribe, followed by the essential links.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • Logo, one line of links and the copyright, centered and airy.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A single strip with copyright, legal pages, cookie settings and back to top.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component