Promo code callout in WordPress
A dashed callout highlighting an offer and its code, with the end date.
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, Encart de code promotionnel
* Description: Un encart en pointillés qui met en avant une offre et son code, avec la date limite. Ajoute la composition « Encart de code promotionnel » à 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-alerte-code-promo
*<!-- wp:group {"tagName": "aside", "className": "promo", "layout": {"type": "default"}} -->
<aside class="wp-block-group promo"><!-- wp:html -->
<svg aria-hidden="true" viewBox="0 0 24 24" width="28" height="28" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3.5 12.5 11 5h8v8l-7.5 7.5a1.5 1.5 0 0 1-2 0l-6-6a1.5 1.5 0 0 1 0-2Z"/><circle cx="15.5" cy="8.5" r="1.3"/></svg>
<!-- /wp:html -->
<!-- wp:group {"layout": {"type": "default"}} -->
<div class="wp-block-group"><!-- wp:heading {"level": 2, "anchor": "promo-title"} -->
<h2 class="wp-block-heading" id="promo-title">−15 % sur votre première commande</h2>
<!-- /wp:heading -->
<!-- wp:paragraph -->
<p>Saisissez le code <code>BIENVENUE15</code> à l'étape du paiement. Offre valable jusqu'au <time datetime="2026-11-30">30 novembre 2026</time>, dès 40 € d'achat.</p>
<!-- /wp:paragraph --></div>
<!-- /wp:group --></aside>:root {
--pr-bg: #fff7ed;
--pr-line: #ea580c;
--pr-text: #2c1404;
--pr-icon: #c2410c;
--pr-code: #ffedd5;
--demo-alerte-code-promo-bg: #ffffff;
--demo-alerte-code-promo-text: #2c1404;
}
@media (prefers-color-scheme: dark) {
:root.forge-follows-system:not([data-theme="light"]) {Free component: copy it freely, including for commercial projects.
Other toasts and alerts components in WordPress
Toasts and alerts components in WordPress
A banner that warns visitors when they lose the network and announces when it is back, using browser events, with no request.
- Tailwind
- React
- CSS
- WordPress

A bell with an unread badge that opens a notification panel: icons by type, read and unread items told apart, and a "Mark all as read" button.
- Tailwind
- React
- CSS
- WordPress

The four classic interface messages: information, success, warning and error.
- Tailwind
- React
- CSS
- WordPress

Three callouts for technical documentation: note, tip and warning.
- Tailwind
- React
- CSS
- WordPress

A notice warning of a scheduled service interruption, with date, time and impact.
- Tailwind
- React
- CSS
- WordPress

An announcement bar at the top of the page with a link and a button to close it.
- Tailwind
- React
- CSS
- WordPress