Menu
All plugins

FAQ with Schema for Bricks

A nestable Bricks element for frequently asked questions. It is an accessible accordion built on native details elements, and it adds one block of FAQPage structured data to the page, built from the questions and answers actually shown.

Version: 0.3.1 · Requires: WordPress 6.0+, PHP 8.1+, Bricks · See the live demo

What it does

  • Shows questions as an accordion with no script. Visitors can open them with the keyboard, and the page works without JavaScript.
  • Writes the FAQPage JSON-LD from the same questions and answers that are on the page, as plain text, so the two cannot drift apart.
  • Merges several FAQ elements on one page into a single block, listing each question once.
  • Works with query loops, so the questions can come from posts or from a repeating custom field.
  • Two looks: lines and cards. One question open at a time, or several.

Installation

  1. Upload and activate the plugin. Bricks must be active.
  2. In the Bricks editor search for FAQ with Schema (General group). It arrives with three sample questions.

Quick start

  1. Edit the question in the heading, and the answer in the text.
  2. Add a question by duplicating an item in the structure panel.
  3. Check the schema by viewing the page source and searching for fsfb-faq-schema.

Using it in a loop, including an ACF repeater

The loop can be a post, term or user query, or a repeater such as an ACF repeater or a Meta Box group. For a repeater, choose it as the loop type on the item block, then use its sub-fields in the dynamic data. The demo includes an example built from an ACF repeater.

  1. Keep one item block (the one with class fq-item) and put the query loop on it.
  2. Use dynamic data for the question and the answer.

The same works with a repeating field, such as an Advanced Custom Fields repeater, using the loop type for that field.

Structured data

  • One FAQPage block is printed in the footer, once per page.
  • The answer text is the plain text of the answer, with tags removed.
  • Turn Output FAQPage schema off on an element if another plugin already outputs FAQ schema for the page. If an SEO plugin such as Rank Math also adds FAQ schema, a page can end up with two blocks, which search engines may treat as an error. Use one or the other.
  • Developers can use the filter fsfb_schema to change the data, or return false from fsfb_schema_enabled to switch the output off site wide, for example to supply your own.
  • The schema is not output in the Bricks editor.

Animation

Questions slide open and closed, with the answer fading as it goes, and the arrow turns with it. Set the time with Animation time, or switch it off with Animate opening and closing. With Only one open at a time, the open question closes as the next one opens. The animation is off for visitors who prefer reduced motion, and the questions work without JavaScript, just without the animation.

Icons

Each question can have its own icon. The sample questions come with an icon element inside the question block. Pick a different icon, or delete it for a question with no icon. Settings let you put the icon before or after the question, and set its size and colour. The open and close marker can be a chevron, a plus and minus, or hidden.

Groups

  • By hand: put each set of questions inside a block with the class fq-group, with a heading that has the class fq-group-title at the top.
  • From an ACF repeater or any loop: choose By dynamic data and type a tag such as {acf_topic}. It is read for each question, so it works with repeater rows too.
  • From a query loop: set Group the questions to a category or other taxonomy, or to a custom field. A heading is added for each group, in the order the groups first appear. Order your query to suit. The top-level parent term can be used for a hierarchy.

All the questions, grouped or not, go into the one FAQPage block.

Settings

  • Output FAQPage schema
  • Questions start — all closed, first open, or all open
  • Only one open at a time — done by the browser
  • Style — lines or cards
  • Question size and colour, answer colour, arrow and line colours, item background, card radius, gap and padding

Tips

  • Only visible questions belong in the schema. Do not hide an item with CSS if it should not be in the markup.
  • Keep answers short and in plain text, which suits both visitors and search engines.

Known limits

  • Each item needs the classes fq-item, fq-q and fq-a, which the sample items already have.
  • Rich markup in an answer, such as lists, is flattened to plain text in the schema only.