Skip to content

Heading with rotating words in WordPress

A hero heading whose last word changes every two seconds, with a checkbox to pause it.

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

effet-mots-alternants.php
<?php
/**
 * Plugin Name: Forge, Titre aux mots qui alternent
 * Description: Un titre d’accroche dont le dernier mot change toutes les deux secondes, avec une case pour mettre en pause. Ajoute la composition « Titre aux mots qui alternent » à 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-effet-mots-alternants
 *
pattern.html
<!-- wp:group {"tagName": "section", "className": "efma", "layout": {"type": "default"}} -->
<section class="wp-block-group efma"><!-- wp:paragraph {"className": "efma__eyebrow"} -->
<p class="efma__eyebrow">Studio Ancre · sites web pour indépendants</p>
<!-- /wp:paragraph -->
<!-- wp:heading {"level": 2, "className": "efma__title", "anchor": "efma-titre"} -->
<h2 class="wp-block-heading efma__title" id="efma-titre">Un site clair et rapide pour votre <span class="efma__window" aria-hidden="true"><span class="efma__list"><span class="efma__word">boulangerie</span><span class="efma__word">garage</span><span class="efma__word">cabinet</span><span class="efma__word">atelier</span><span class="efma__word">boulangerie</span></span></span><span class="efma__sr">commerce, qu’il s’agisse d’une boulangerie, d’un garage, d’un cabinet ou d’un atelier</span></h2>
<!-- /wp:heading -->
<!-- wp:paragraph {"className": "efma__text"} -->
<p class="efma__text">Conception, rédaction et mise en ligne en trois semaines, puis un interlocuteur unique pour les mises à jour. Devis gratuit sous 48 h.</p>
<!-- /wp:paragraph -->
<!-- wp:group {"className": "efma__actions", "layout": {"type": "default"}} -->
<div class="wp-block-group efma__actions"><!-- wp:html -->
style.css
:root {
  --efma-bg: #eef2ff;
  --efma-text: #1e1b4b;
  --efma-body: #3730a3;
  --efma-word: #4338ca;
  --efma-accent: #4338ca;
  --efma-on-accent: #ffffff;
  --demo-effet-mots-alternants-bg: #f7f8ff;
  --demo-effet-mots-alternants-text: #1e1b4b;
}

@media (prefers-color-scheme: dark) {

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

Visual effects components in WordPress
  • Cards that fade in as they enter the screen, one after another in each row, without a line of JavaScript and with a static fallback.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A translucent card with a saturated blur whose sharper edge refracts the colourful shapes drifting behind it, with an opaque fallback when transparency is reduced.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A help block shaped like a conversation: bubbles, three animated typing dots and clickable quick replies that show your answers to frequent questions, frozen under prefers-reduced-motion.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A paragraph whose words turn from grey to full ink, one by one, as the page scrolls, in pure CSS with a plain-text fallback.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • Four offset, translucent sine waves gently roll along the bottom of a section, each at its own pace.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component