Skip to content

Service area and response time table in WordPress

A table of the towns and postcodes a tradesperson covers, with response time and travel fee, filtered by search and by zone.

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

pattern.html
<!-- wp:html -->
<section class="tzd" data-tzd aria-labelledby="tzd-titre">
        <div class="tzd-intro">
          <h2 class="tzd-title" id="tzd-titre">Zones d’intervention</h2>
          <p class="tzd-lead">Plomberie et chauffage autour de Nantes : retrouvez votre commune pour connaître le délai de passage et les frais de déplacement.</p>
        </div>
        <div class="tzd-tools" data-tzd-tools hidden>
          <div class="tzd-field" role="search">
            <label class="tzd-glabel" for="tzd-recherche">Commune ou code postal</label>
            <input class="tzd-input" id="tzd-recherche" type="search" autocomplete="off" spellcheck="false" placeholder="Ex. : Rezé ou 44400" aria-describedby="tzd-aide" data-tzd-search>
            <span class="tzd-hint" id="tzd-aide">Accents et tirets facultatifs, « st » vaut « saint ».</span>
          </div>
script.js
(() => {
  if (!document.querySelector(".tzd")) return;
  document.querySelectorAll("[data-tzd]").forEach((root) => {
    const on = (el, type, fn) => el.addEventListener(type, fn);
    const tbody = root.querySelector("tbody");
    const rows = [...tbody.rows];
    const input = root.querySelector("[data-tzd-search]");
    const status = root.querySelector("[data-tzd-status]");
    const empty = root.querySelector("[data-tzd-empty]");
    const picks = [...root.querySelectorAll("button[data-tzd-pick]")];
    // Visitors type "st etienne" or "reze": accents, hyphens and the usual abbreviations must not matter.
    const norm = (s) =>
style.css
:root {
  --tzd-card: #ffffff;
  --tzd-text: #1a2230;
  --tzd-muted: #4b5563;
  --tzd-line: #d8dee8;
  --tzd-head: #f2f5f9;
  --tzd-accent: #1d4ed8;
  --tzd-on-accent: #ffffff;
  --tzd-z1: #dcfce7;
  --tzd-z1-text: #14532d;
  --tzd-z2: #fef3c7;
  --tzd-z2-text: #78350f;
tableau-zones-delais-intervention.php
<?php
/**
 * Plugin Name: Forge, Tableau des zones et délais
 * Description: Un tableau des communes et codes postaux desservis par un artisan, avec délai d’intervention et frais de déplacement, filtrable par recherche et par zone. Ajoute la composition « Tableau des zones et délais » à 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-tableau-zones-delais-intervention
 *

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

Data tables components in WordPress
  • A documentation table showing where a kit or component has been tested (static HTML, WordPress, Elementor, Webflow, v0…), with status, last test date and a remark, filterable by status.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A timetable table sorted by column and filtered with level and free-place chips, whose rows each become a card on phones.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A filterable table whose visible rows export in one click to a CSV file that opens cleanly in Excel or LibreOffice.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A price table by service: one package to pick, options to tick, and the total with the estimated time recalculated on every click.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • A product spec sheet as two-column tables in native collapsible sections, with a button to open or close them all.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • The results of a race or competition, sortable by place, name or category, with the podium highlighted, the gap to the winner and the sort order announced.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component