Skip to content

Section dot navigation in WordPress

A column of dots on the side of the page that follows the section being read and lets visitors jump to it, with a label on hover and focus.

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

navigation-points-sections.php
<?php
/**
 * Plugin Name: Forge, Points de navigation par section
 * Description: Une colonne de points sur le côté de la page qui suit la section en cours de lecture et permet d’y sauter, avec libellé au survol et au focus. Ajoute la composition « Points de navigation par section » à 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-navigation-points-sections
 *
pattern.html
<!-- wp:html -->
<div class="nps" data-nps>
        <div class="nps-sections">
          <section class="nps-section" id="nps-domaine" aria-labelledby="nps-domaine-titre" data-nps-section>
            <p class="nps-num">01</p>
            <h2 class="nps-h2" id="nps-domaine-titre">Le domaine</h2>
            <p class="nps-p">Quarante hectares de vignes en coteaux, cultivés en biodynamie depuis 2011, entre Loire et forêt de Chinon.</p>
          </section>
          <section class="nps-section" id="nps-cuvees" aria-labelledby="nps-cuvees-titre" data-nps-section>
            <p class="nps-num">02</p>
            <h2 class="nps-h2" id="nps-cuvees-titre">Nos cuvées</h2>
            <p class="nps-p">Chinon rouge de garde, rosé de saignée et un chenin sec élevé en fût, vendus au caveau et chez une trentaine de cavistes.</p>
script.js
(() => {
  if (!document.querySelector(".nps")) return;
  document.querySelectorAll("[data-nps]").forEach((root) => {
    const on = (el, type, fn) => el.addEventListener(type, fn);
    const offs = [];
    const links = [...root.querySelectorAll("[data-nps-link]")];
    const current = (id) => {
      links.forEach((link) => {
        if (link.hash === `#${id}`) link.setAttribute("aria-current", "true");
        else link.removeAttribute("aria-current");
      });
    };
style.css
:root {
  --nps-text: #23180f;
  --nps-muted: #5c4b3d;
  --nps-panel: #fbf6ef;
  --nps-panel-alt: #f2e9dc;
  --nps-dot: #a08a75;
  --nps-accent: #7c2d12;
  --nps-tip: #23180f;
  --nps-tip-text: #fbf6ef;
  --demo-navigation-points-sections-bg: #ece3d6;
  --demo-navigation-points-sections-text: #23180f;
}

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

Breadcrumbs and pagination components in WordPress
  • A bottom bar with Call, Directions and Free quote that tucks away while visitors read down the page and returns as soon as they scroll up. Built for tradespeople whose customers arrive on a phone.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A slim bar at the top of the page with a message, a link and a close button; once closed, it stays hidden for the period you choose.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A sticky sidebar table of contents for blog posts: it highlights the section being read, shows the reading time left and folds into a list under the title on mobile.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • An order step indicator: finished steps clickable to go back, the current step announced, upcoming steps locked.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • Tooltips in four positions that open on hover, tap and keyboard focus, and close with Escape, as WCAG requires.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • Quick access links that appear on the first Tab press to skip the header and menu, as required by the RGAA and WCAG.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component