Floating WhatsApp button in WordPress
A WhatsApp button pinned to the bottom of the screen that opens a welcome bubble with common topics and a pre-filled message, with no third-party widget.
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, Bouton WhatsApp flottant
* Description: Un bouton WhatsApp fixe en bas de l'écran qui ouvre une bulle d'accueil avec sujets fréquents et message pré-rempli, sans widget tiers. Ajoute la composition « Bouton WhatsApp flottant » à 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-bouton-whatsapp-flottant
*<!-- wp:group {"className": "bwf-page", "layout": {"type": "default"}} -->
<div class="wp-block-group bwf-page"><!-- wp:group {"tagName": "header", "className": "bwf-hero", "layout": {"type": "default"}} -->
<header class="wp-block-group bwf-hero"><!-- wp:paragraph {"className": "bwf-hero__kicker"} -->
<p class="bwf-hero__kicker">Céramiste à Dieulefit, dans la Drôme</p>
<!-- /wp:paragraph -->
<!-- wp:heading {"level": 1} -->
<h1 class="wp-block-heading">Atelier Terre & Feu</h1>
<!-- /wp:heading -->
<!-- wp:paragraph {"className": "bwf-hero__intro"} -->
<p class="bwf-hero__intro">Vaisselle en grès tournée à la main, stages pour débutants et commandes sur mesure. Une question ? Écrivez-nous sur WhatsApp, Clara répond depuis l'atelier.</p>
<!-- /wp:paragraph --></header>
<!-- /wp:group -->(() => {
if (!document.querySelector(".bwf-page")) return;
// Builds the wa.me link from the message, so nothing is loaded from WhatsApp before the visitor clicks.
document.querySelectorAll("[data-bwf]").forEach((root) => {
const panel = root.querySelector("[data-bwf-panel]");
const toggle = root.querySelector("[data-bwf-toggle]");
const message = root.querySelector("[data-bwf-message]");
const send = root.querySelector("[data-bwf-send]");
const topics = root.querySelectorAll("[data-bwf-topic]");
const base = `https://wa.me/${root.dataset.bwfPhone}`;
function update() {:root {
--bwf-text: #0f1f17;
--bwf-body: #3b4a42;
--bwf-accent: #0f6b37;
--bwf-surface: #ffffff;
--bwf-line: #d5e6dc;
--bwf-shadow: 0 12px 32px rgb(15 31 23 / 0.18);
--bwf-fab-shadow: 0 8px 24px rgb(15 31 23 / 0.28);
--bwf-head-bg: #0f5132;
--bwf-head-text: #ffffff;
--bwf-head-sub: #d1fae5;
--bwf-greet-bg: #e7f6ec;Free component: copy it freely, including for commercial projects.
Other buttons components in WordPress
Buttons components in WordPress
A row of buttons to share the page on Facebook, LinkedIn, WhatsApp or by email, with a copy-link button and no third-party script.
- Tailwind
- React
- CSS
- WordPress

Toggle heart buttons that count favourites, remember them between visits and announce them to screen readers.
- Tailwind
- React
- CSS
- WordPress

A button that adds an event to Google Calendar, Outlook or any calendar through an .ics file, with no third-party service.
- Tailwind
- React
- CSS
- WordPress

A button that copies an IBAN, a reference, an address or a promo code and confirms "Copied", on screen and to screen readers.
- Tailwind
- React
- CSS
- WordPress

A bar pinned to the bottom of mobile screens with Call and Directions buttons and a live open-now status, built for trades and local shops.
- Tailwind
- React
- CSS
- WordPress

Circular icon buttons with an accessible tooltip on hover and focus.
- Tailwind
- React
- CSS
- WordPress