Skip to content

Service area in WordPress

The list of towns served, grouped by department, with search by name or postcode, a 10 to 30 km radius and call-out fees: a block that helps local search rankings.

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

features-zone-intervention.php
<?php
/**
 * Plugin Name: Forge, Zone d'intervention
 * Description: La liste des communes desservies, classées par département, avec recherche par nom ou code postal, rayon de 10 à 30 km et frais de déplacement : un bloc utile au référencement local. Ajoute la composition « Zone d'intervention » à 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-features-zone-intervention
 *
pattern.html
<!-- wp:html -->
<section class="zint" aria-labelledby="zint-titre" data-zint>
        <div class="zint__head">
          <p class="zint__eyebrow">Zone d'intervention</p>
          <h2 class="zint__title" id="zint-titre">Plombier chauffagiste autour de Villeurbanne</h2>
          <p class="zint__intro">Garnier Plomberie se déplace dans 32 communes du Rhône, de l'Ain et de l'Isère, à moins de 30 km de l'atelier : dépannage de fuite, remplacement de chauffe-eau et entretien de chaudière.</p>
        </div>
        <div class="zint__layout">
          <div class="zint__aside">
            <h3 class="zint__subtitle">Frais de déplacement</h3>
            <svg class="zint__map" viewBox="0 0 200 200" aria-hidden="true" focusable="false">
              <circle class="zint__ring" cx="100" cy="100" r="88" data-zint-ring="30" data-on=""/>
script.js
(() => {
  if (!document.querySelector(".zint")) return;
  (() => {
    const normalize = (value) =>
      value
        .toLowerCase()
        .normalize("NFD")
        .replace(/[̀-ͯ]/g, "")
        .replace(/[-'’]/g, " ")
        .replace(/\s+/g, " ")
        .trim();
    // "St Priest" and "Saint-Priest" both find the commune.
style.css
:root {
  --zint-text: #13201d;
  --zint-muted: #4b5d58;
  --zint-card: #ffffff;
  --zint-line: #d3dfdb;
  --zint-field-line: #8fa39d;
  --zint-placeholder: #5f716c;
  --zint-accent: #0f766e;
  --zint-soft: #e0f2ef;
  --zint-link-bg: #0f766e;
  --zint-link-hover: #115e59;
  --zint-link-text: #ffffff;

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

Features components in WordPress
  • Three cards in saturated flat colours (yellow, pink, electric blue) with high-contrast text and a dark variant. Every colour pair is measured at AA: 5.5:1 at worst.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • Six features as frosted glass cards over a slowly drifting aurora mesh gradient. Pause button, still background under prefers-reduced-motion, CSS and a light script.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • The key message stays pinned while the background changes colour and illustration at each scroll step. CSS sticky, a light script, stacked cards as fallback under prefers-reduced-motion.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A six-cell bento grid: key figures, SVG sparklines, a quote and icons. All the text is in the HTML and the animation is CSS only, with no script at all.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A two-offer table: checked rows, a column highlighted from top to bottom and one call-to-action button per offer. Pure HTML and CSS, no script at all.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A magazine-style article: title band, standfirst, drop cap, subheadings and a pull quote, set in three columns of equal height. Pure CSS, no script at all.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component