Edit to add: I just realized I needed to download the official Gutenberg plugin and now my widget area uses blocks. Hurray! https://wordpress.org/plugins/gutenberg/
Unfortunately, this accordion block is not yet updated or adapted to be useable in the Gutenberg widget space. Still doesn’t work yet, but I hope for updates.
-
This reply was modified 5 years, 1 month ago by
veronicadyer.
You can use accordions outside the main editor, it just requires you to get the right HTML in the right places (this is also not an officially supported feature, so use are your own risk).
Something like this should work. Note the 12345 in 3 places below. You’ll need a unique id for each accordion item on the page.
<div class="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">
<button id="at-12345" class="c-accordion__title c-accordion__title--button js-accordion-controller" aria-controls="ac-12345">
Accordion item title
</button>
<div id="ac-12345" class="c-accordion__content" style="display: none;">
Accordion item content.
</div>
</div>