How can I create a flexible Accordion FAQ component with a dynamic number of items (without ACF/plugins)?

Hi everyone,

I’m building a reusable FAQ Accordion component in Bricks that I want to place on different pages across my site. Each page should be able to show a different number of FAQ items (questions + answers).

My target is:

  • One single FAQ component

  • Insertable on many pages

  • Each instance can contain 3 to 7 FAQ items, depending on the page

  • Each item has its own Title (question) and Content (answer) via component properties

  • No plugins (e.g. ACF/Metabox)

:backhand_index_pointing_right: My goal is to find a clean and Bricks-compatible approach to control the number of FAQ entries for each instance of the component

…ideally using only Bricks core functionality, no external plugins.

Any help, suggestion, or workaround is highly appreciated! :folded_hands:

You can use a accordion nesteble to do so. Shows the title (question) and opens when clicked (answer).

Without custom fields or custom posttype you could use post categories were you load all posts assignt to that category.

To load the categories inside the accordion you need a query set to load the specific category.

Not sure if components is a good idea. I would make the accordion a template and put the query on the container outside of the template. This way you can change the query category on the page itself while the accordion is global.

When using the normal WordPress postype all dynamic keys are the same. posttile (question) and post content (answer). You can also assign the same question to several categories to span several accordions.

1 Like