Callback request dialog in WordPress
A short form in a window to request a call from an advisor.
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, Fenêtre de demande de rappel
* Description: Un court formulaire dans une fenêtre pour être rappelé par un conseiller. Ajoute la composition « Fenêtre de demande de rappel » à 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-modale-formulaire-rappel
*<!-- wp:html -->
<button type="button" class="call-trigger" data-dialog-open="callback-dialog">Être rappelé gratuitement</button>
<!-- /wp:html -->
<!-- wp:html -->
<dialog id="callback-dialog" aria-labelledby="callback-title">
<form class="callback" data-callback-form action="#rappel">
<header>
<h2 id="callback-title">Un conseiller vous rappelle</h2>
<button type="button" class="close-button-modale-formulaire-rappel" data-dialog-close aria-label="Fermer"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M6 6l12 12M18 6 6 18"/></svg></button>
</header>
<label for="callback-name">Prénom et nom</label>(() => {
if (!document.querySelector(".call-trigger")) return;
document.querySelectorAll("[data-dialog-open]").forEach((button) => {
const dialog = document.getElementById(button.dataset.dialogOpen);
button.addEventListener("click", () => dialog.showModal());
});
document.querySelectorAll("dialog").forEach((dialog) => {
dialog.addEventListener("click", (event) => {
if (event.target === dialog) dialog.close();
});
dialog.querySelectorAll("[data-dialog-close]").forEach((button) => {:root {
--call-bg: #ffffff;
--call-text: #042f2e;
--call-line: rgb(4 47 46 / 0.3);
--call-accent: #0f766e;
--call-accent-text: #ffffff;
--call-ring: #0f766e;
--demo-modale-formulaire-rappel-bg: #f0fdfa;
--demo-modale-formulaire-rappel-text: #042f2e;
}
@media (prefers-color-scheme: dark) {Free component: copy it freely, including for commercial projects.
Other modals components in WordPress
Modals components in WordPress
Age verification
FreeA legal-age check window for a wine shop or brewery, accessible, remembered for the session and with the French Evin law notices.
- Tailwind
- React
- CSS
- WordPress

A search covering the page, with popular suggestions, opened from the navigation bar.
- Tailwind
- React
- CSS
- WordPress

A small window asking to confirm an action before running it.
- Tailwind
- React
- CSS
- WordPress