FAQ with helpfulness vote in WordPress
A native accordion FAQ where each answer asks “Was this answer helpful?”, with a thank-you message and a remembered vote.
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, FAQ avec vote « utile »
* Description: Une FAQ en accordéon natif où chaque réponse demande « Cette réponse vous a-t-elle aidé ? », avec remerciement et vote mémorisé. Ajoute la composition « FAQ avec vote « utile » » à 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-faq-vote-utile
*<!-- wp:html -->
<section class="fvu" data-fvu aria-labelledby="fvu-titre">
<h2 class="fvu-title" id="fvu-titre">Questions fréquentes</h2>
<details class="fvu-item" data-fvu-item="caution">
<summary class="fvu-q">Faut-il laisser une caution pour louer un vélo ?</summary>
<div class="fvu-a">
<p class="fvu-p">Oui, une empreinte bancaire de 300 € est demandée au départ. Rien n’est débité : elle est libérée dès le retour du vélo, sous 48 h selon votre banque.</p>
<div class="fvu-vote" data-fvu-vote hidden>
<p class="fvu-ask" id="fvu-q-caution">Cette réponse vous a-t-elle aidé ?</p>
<div class="fvu-buttons" role="group" aria-labelledby="fvu-q-caution">
<button class="fvu-btn" type="button" data-fvu-answer="oui">Oui</button>
<button class="fvu-btn" type="button" data-fvu-answer="non">Non</button>(() => {
if (!document.querySelector(".fvu")) return;
document.querySelectorAll("[data-fvu]").forEach((root) => {
const on = (el, type, fn) => el.addEventListener(type, fn);
const KEY = "forge-fvu-votes";
let votes = {};
try {
votes = JSON.parse(localStorage.getItem(KEY) ?? "{}");
} catch {
votes = {};
}
const MESSAGES = {:root {
--fvu-card: #ffffff;
--fvu-text: #10233a;
--fvu-muted: #46566b;
--fvu-line: #d5dee8;
--fvu-soft: #f1f6fb;
--fvu-accent: #0b5cad;
--fvu-accent-text: #ffffff;
--demo-faq-vote-utile-bg: #e9eff5;
--demo-faq-vote-utile-text: #10233a;
}
Free component: copy it freely, including for commercial projects.
Other FAQ and accordions components in WordPress
FAQ and accordions components in WordPress
Two-column FAQ
FreeAn introduction and a contact link on the left, expandable questions on the right.
- Tailwind
- React
- CSS
- WordPress

A tight accordion within a single frame, for practical information pages.
- Tailwind
- React
- CSS
- WordPress

FAQ by category
FreeQuestions grouped under subheadings, for long FAQs.
- Tailwind
- React
- CSS
- WordPress

Open card FAQ
FreeAll answers visible at once, presented as a card grid.
- Tailwind
- React
- CSS
- WordPress

Frequently asked questions followed by a card inviting visitors to call or write.
- Tailwind
- React
- CSS
- WordPress

Accordion FAQ
FreeQuestions that expand one by one, with FAQPage structured data for Google.
- Tailwind
- React
- CSS
- WordPress