Accordion Blocks


Accordion Blocks is a simple plugin that adds Gutenberg blocks for adding accordion drop-downs to your pages.

The accordions should blend seamlessly with your theme. However, you may want to add custom styles to your theme.


  • Adds a Gutenberg block for adding accordions to your site.
  • Supports multiple accordions with individual settings for each accordion item.
  • Fully responsive.
  • Support for item IDs and direct links.
  • Accessible (for users requiring tabbed keyboard navigation control).

Optional Features

  • Open individual accordion items by default.
  • Disable auto closing of accordion items.
  • Manually close items by clicking the title again.
  • Scroll page to title when it’s clicked open (including setting a scroll offset position).
  • Set the HTML heading tag for the title element (h1–h4, button).


The plugin will ultimately output following HTML (simplified for this example):

<div class="wp-block-pb-accordion-item c-accordion__item js-accordion-item" data-initially-open="false" data-click-to-close="true" data-auto-close="true" data-scroll="false" data-scroll-offset="0">
    <h2 id="at-76840" class="c-accordion__title js-accordion-controller" tabindex="0" role="button" aria-controls="ac-76840" aria-expanded="false">
        Title with H2 tag
    <div id="ac-76840" class="c-accordion__content" style="display:none" aria-hidden="true">

Custom CSS

You can use the following CSS classes to customize the look of the accordion.

.c-accordion__item {} /* The accordion item container */ {} /* is-open is added to open accordion items */ {} /* is-read is added to accordion items that have been opened at least once */
.c-accordion__title {} /* An accordion item title */
.c-accordion__title--button {} /* An accordion item title that is using a `<button>` tag */
.c-accordion__title:hover {} /* To modify the style when hovering over an accordion item title */
.c-accordion__title:focus {} /* To modify the style when an accordion item title currently has broswer focus */
.c-accordion__content {} /* An accordion item content container */


This plugin provides 1 block.

Accordion Blocks


  1. Upload the ‘accordion-blocks’ folder to the ‘/wp-content/plugins/’ directory.
  2. Activate the plugin through the Plugins menu in WordPress.
  3. Add the accordions to your content.


Why isn’t the JavaScript file loading on my site?

This is most likely caused by a poorly coded theme. This plugin makes use of the wp_footer() function to load the JavaScript file and it’s dependancy (jQuery). Check your theme to ensure that the wp_footer() function is being called right before the closing </body> tag in your theme’s footer.php file.


For bug reports or feature requests or if you’d like to contribute to the plugin you can check everything out on Github.


December 6, 2019
Great stuff, lightweight, can really recommend this! The plugin has all the functional settings I needed, and the style was easily customized with a little CSS. I hope that this gets more traction and that the plugin author will keep supporting it! Thank your for work, Phil!
November 20, 2019
At first this block confused me, I was looking for a second block but it's not there. The on block does the whole trick. I like the cleanness of the block.
November 5, 2019
This does just what I want (with some minimal CSS). It's very lightweight compared to other "blocks-r-us" plugins that do a lot of stuff you don't need. Very flexible and no monkeying around with plugin interface and shortcodes. Makes my day!
October 28, 2019
This is great, it's nice to have this block as a standalone rather than bundled with 30 other blocks we don't need. It would be nice to set a default header style or limit the options in the editor, but I'm okay just forcing the desired result in CSS for now!!
Read all 10 reviews

Contributors & Developers

“Accordion Blocks” is open source software. The following people have contributed to this plugin.


Translate “Accordion Blocks” into your language.

Interested in development?

Browse the code, check out the SVN repository, or subscribe to the development log by RSS.

Change log


  • Fixed typo in plugin settings


  • Added minified versions of JS and CSS files


  • Made plugin translatable
  • Code cleanup


  • Added the ability to convert a paragraph or heading into an accordion.


  • Added the ability for the block in the editor to accept custom css classes (allows for custom registration of Block Styles)
  • Accessibility fix: Removed aria-hidden=false from closed accordions.


  • Updated readme.


  • All new plugin to support the new WordPress Gutenberg editor.