philbuchanan / Accordion-Shortcodes

A WordPress plugin that adds a few shortcodes to allow for accordion dropdowns.
https://wordpress.org/plugins/accordion-shortcodes/
16 stars 10 forks source link

Nested accordions does not work #40

Closed JohnMidity closed 8 years ago

JohnMidity commented 8 years ago

An accordion inside an accordion item does not work.

[accordion]
    [accordion-item title="1"]one[/accordion-item]
    [accordion-item title="a-z"]
        [accordion]
            [accordion-item title="a"]a[/accordion-item]
            [accordion-item title="b"]b[/accordion-item]
        [/accordion]
    [/accordion-item]
[/accordion]

This results in a stray [/accordion-item] [/accordion] on the page and a badly working accordion.

philbuchanan commented 8 years ago

This is a limitation of WordPress and how it parses for shortcodes. You are unable to nest shortcodes of the same name within each other.

postmastersteve commented 8 years ago

What about supporting nested accordions with another name? Such as with the compatibility mode prefix already supported? (e.g. [as-accordion]) I only need to add a second level - is there really no way around this?

philbuchanan commented 8 years ago

Technically it could be possible to add additional shortcodes with different names that would support this, but it would add considerable complexity to the plugin. I also wound not recommend it from a UX perspective.

This plugin is not meant to solve all problems that all users have. If you really need nesting of accordions I suggest looking into other plugins.