Skip to content

Accordion Shortcode

Oliver Juhas edited this page Jun 22, 2017 · 9 revisions

Info

Displays accordion (only 1 section can be opened at time) or toggles (multiple sections can be opened).
It is also possible to display sections filter created from the accordion items (sections) tags.


Example

This shortcode is a wrapper for an additional item child shortcode and requires it to work properly.
Use both shortcodes to create a full accordion element, such as:

[wm_accordion active="0" mode="accordion" filter="1"]
[wm_item title="First section" tags="Topic one"]
Section text here.
[/wm_item]
[wm_item title="Second section" tags="Topic two"]
Section text here.
[/wm_item]
[wm_item title="Last section" tags="Topic one"]
Section text here.
[/wm_item]
[/wm_accordion]

Add as many item sub-shortcodes as you need. Each item represents an accordion section.


Parameters

Please note that you can omit parameters with empty values when writing the shortcode.

Parameter Type Value example    Description
active integer 0, 1, 2,… Order number of the accordion item (section) to be opened by default. For example, 0 stands for all items closed, 1 stands for first section opened, and so on.
class string my-class Adds a custom CSS class(es) onto shortcode wrapper.
filter boolean 0 (false) or 1 (true) Enables or disables the accordion items filter. Please note that you need to set tags for the items for filter to display.
mode predefined accordion or toggle Sets the shortcode mode: whether to display accordion, or toggles.

Compatibility

Please, make sure your theme supports this shortcode, before using it.
Some themes may not be compatible with certain shortcodes as they may use different approach to displaying similar elements. In that case the shortcode is displays in its raw code format on your website front-end.