Social media share buttons 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.
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, Boutons de partage sur les réseaux sociaux
* Description: Une rangée de boutons pour partager la page sur Facebook, LinkedIn, WhatsApp ou par e-mail, avec copie du lien, sans aucun script tiers. Ajoute la composition « Boutons de partage sur les réseaux sociaux » à 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-partage-reseaux-sociaux
*<!-- wp:html -->
<div class="bprs" data-bprs data-bprs-title="Entretenir une terrasse en bois avant l’hiver" role="group" aria-labelledby="bprs-titre">
<div class="bprs-head">
<p class="bprs-title" id="bprs-titre">Partager cet article</p>
<p class="bprs-hint">Un proche prépare sa terrasse ? Envoyez-lui ce guide.</p>
</div>
<ul class="bprs-list">
<li>
<a class="bprs-btn bprs-btn--facebook" href="https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fforgefrance.fr%2F" data-bprs-net="facebook" target="_blank" rel="noopener noreferrer">
<svg class="bprs-icon" viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="8.5"/><path d="M13 20.5v-7h2.4l.4-2.8H13V9.2c0-.8.3-1.3 1.4-1.3H16V5.4a17 17 0 0 0-2.1-.1c-2 0-3.4 1.2-3.4 3.5v1.9H8.3v2.8h2.2v7"/></svg>
<span><span class="bprs-sr">Partager sur </span>Facebook</span><span class="bprs-sr"> (nouvel onglet)</span>
</a>(() => {
if (!document.querySelector(".bprs")) return;
document.querySelectorAll("[data-bprs]").forEach((root) => {
const on = (el, type, fn) => el.addEventListener(type, fn);
const offs = [];
const field = root.querySelector("[data-bprs-field]");
const fallback = root.querySelector("[data-bprs-fallback]");
const copy = root.querySelector("[data-bprs-copy]");
const label = root.querySelector("[data-bprs-label]");
const status = root.querySelector("[data-bprs-status]");
const canonical = document.querySelector('link[rel="canonical"]')?.href;
// The address written in the markup stays the shared one on a local file or a sandboxed preview.:root {
--bprs-card: #ffffff;
--bprs-text: #1c2430;
--bprs-muted: #4f5b6b;
--bprs-line: #d5dbe3;
--bprs-btn: #f4f6f9;
--bprs-hover: #e9eef5;
--bprs-focus: #1d4ed8;
--bprs-facebook: #0b5fcc;
--bprs-linkedin: #0a66c2;
--bprs-whatsapp: #0f7b3f;
--bprs-mail: #9a3412;Free component: copy it freely, including for commercial projects.
Other buttons components in WordPress
Buttons components in 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 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.
- 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