MWDelaney / bootstrap-3-shortcodes

WordPress shortcodes for easier use of Bootstrap elements in your content.
https://wordpress.org/plugins/bootstrap-3-shortcodes/
MIT License
377 stars 118 forks source link

Using collapses outside of collapsibles shortcode #121

Closed rogerlos closed 9 years ago

rogerlos commented 9 years ago

I believe bootstrap allows the use of collapses outside of an accordion-style set of collapses. If you do this using Bootstrap 3 Shortcodes, PHP will throw errors. If you changed the function bs_collapse to reflect the following changes, [collapse] would work fine with or without the surrounding [collapsibles] shortcode.

Line 1321 (added test for global):

$parent = isset( $GLOBALS['collapsibles_count'] ) ? 
    'custom-collapse-' . $GLOBALS['collapsibles_count'] : null;

Line 1330 (removed data-parent="" wrapper from %4):

<a class="%3$s" data-toggle="collapse"%4$s href="#%5$s">%6$s</a>

Line 1340 (add ternary to see if $parent was null, if not, added data wrapper back in):

$parent !== null ? ' data-parent="#' . $parent . '""' : '',
MWDelaney commented 9 years ago

This should be all set! Thank you for this report.

rogerlos commented 9 years ago

No worries, thanks for the plugin!