Countdown CTA in WordPress
A call to action for a limited offer: serif heading, two links and a countdown in days, hours and minutes inside a coupon-style frame.
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
The code in WordPress
<?php
/**
* Plugin Name: Forge, CTA compte à rebours
* Description: Un appel à l'action pour une offre limitée : titre à empattements, deux liens et un décompte en jours, heures et minutes dans un cadre façon bon de réduction. Ajoute la composition « CTA compte à rebours » à 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-cta-compte-a-rebours
*<!-- wp:html -->
<section class="cdown" aria-labelledby="cdown-title" data-countdown>
<div class="cdown__text">
<p class="cdown__eyebrow">Offre de la semaine</p>
<h2 class="cdown__title" id="cdown-title">−20 % sur les ateliers pâtisserie du week-end</h2>
<p class="cdown__lead">Macarons, tarte au citron meringuée ou pâte feuilletée : trois heures en petit groupe avec un chef, tablier et boîte à emporter compris.</p>
<div class="cdown__actions">
<a class="cdown__primary" href="#reserver">Réserver mon atelier</a>
<a class="cdown__link" href="#programme">Voir le programme</a>
</div>
</div>
<div class="cdown__timer">(() => {
if (!document.querySelector(".cdown")) return;
document.querySelectorAll("[data-countdown]").forEach((root) => {
const fixed = root.dataset.deadline ? new Date(root.dataset.deadline) : null;
const units = root.querySelector("[data-countdown-units]");
const ended = root.querySelector("[data-countdown-ended]");
const pad = (n) => String(n).padStart(2, "0");
// Without a fixed date the offer renews every week and ends on Sunday at midnight.
function deadline(now) {
if (fixed) return fixed;
const end = new Date(now);:root {
--cdown-bg: #991b1b;
--cdown-text: #fff7ed;
--cdown-muted: #fecaca;
--cdown-cream: #fef3c7;
--cdown-tile: #7f1d1d;
--cdown-button: #fef3c7;
--cdown-button-hover: #ffffff;
--cdown-button-text: #7f1d1d;
--cdown-ring: #fef3c7;
--demo-cta-compte-a-rebours-bg: #fef2f2;
--demo-cta-compte-a-rebours-text: #450a0a;Free component: copy it freely, including for commercial projects.
Other calls to action components in WordPress
Calls to action components in WordPress
A promotional card for a course, a workshop or an opening: remaining seats, a fill bar, the registration deadline and a booking button, with no countdown timer.
- Tailwind
- React
- CSS
- WordPress

A Free quote within 24 hours banner with a request button, a clickable phone number and three guarantees (no commitment, fast reply, free visit), with no JavaScript.
- Tailwind
- React
- CSS
- WordPress

A desktop contact card with a clickable tel: number, a live Available badge and response hours, for tradespeople who want to be phoned directly.
- Tailwind
- React
- CSS
- WordPress

A direct-call block for emergencies, with the number in very large type and response times.
- Tailwind
- React
- CSS
- WordPress

A sign-up box with an email field, a button and a note on how the address is used.
- Tailwind
- React
- CSS
- WordPress

A full-width band with a heading, a sentence and two action buttons.
- Tailwind
- React
- CSS
- WordPress