Skip to content

FAQ by category in WordPress

Questions grouped under subheadings, for long FAQs.

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

Open in a new tab

The code in WordPress

faq-categories.php
<?php
/**
 * Plugin Name: Forge, FAQ par catégories
 * Description: Des questions regroupées sous des intertitres, pour les FAQ longues. Ajoute la composition « FAQ par catégories » à 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-categories
 *
pattern.html
<!-- wp:group {"tagName": "section", "className": "cats", "layout": {"type": "default"}} -->
<section class="wp-block-group cats"><!-- wp:heading {"level": 2} -->
<h2 class="wp-block-heading">Questions fréquentes</h2>
<!-- /wp:heading -->
<!-- wp:group {"className": "cats__group", "layout": {"type": "default"}} -->
<div class="wp-block-group cats__group"><!-- wp:heading {"level": 3} -->
<h3 class="wp-block-heading">Réservations</h3>
<!-- /wp:heading -->
<!-- wp:details -->
<details class="wp-block-details"><summary>Faut-il réserver ?</summary><!-- wp:paragraph -->
<p>Oui, le soir et le week-end. Le midi en semaine, nous gardons quelques tables pour les clients de passage.</p>
<!-- /wp:paragraph --></details>
style.css
:root {
  --cats-text: #2d1810;
  --cats-muted: #6b4434;
  --cats-line: #e3d3c3;
  --cats-accent: #9f2d20;
  --cats-ring: #9f2d20;
  --demo-faq-categories-bg: #fbf4ee;
  --demo-faq-categories-text: #2d1810;
}

@media (prefers-color-scheme: dark) {
  :root.forge-follows-system:not([data-theme="light"]) {

Free component: copy it freely, including for commercial projects.

FAQ and accordions components in WordPress
  • A native accordion FAQ where each answer asks “Was this answer helpful?”, with a thank-you message and a remembered vote.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • An introduction and a contact link on the left, expandable questions on the right.

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

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • All answers visible at once, presented as a card grid.

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

    • Tailwind
    • React
    • CSS
    • WordPress
    Component
  • Questions that expand one by one, with FAQPage structured data for Google.

    • Tailwind
    • React
    • CSS
    • WordPress
    Component