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

Nav shortcode: dropdown menu has extra node #114

Closed rku4er closed 9 years ago

rku4er commented 9 years ago

I have an issue with nav shortcode. I have extra link nodes appended to .dropdown-menu:

<ul class="dropdown-menu" role="menu">
    <a data-toggle="dropdown" class=" dropdown-toggle" href="#"></a>
    <li class="" role="presentation">
        <a data-toggle="dropdown" class=" dropdown-toggle" href="#"></a>
        <a class="" href="#" role="menuitem">Item 2.1</a>
    </li>
    <li class="" role="presentation"><a class="" href="#" role="menuitem">Item 2.2</a></li>
</ul>

I have looked through plugi code and found problem place. It's bootstrap-shortcodes.php line 476:

    $content = ( $dropdown ) ? str_replace( '[dropdown]', '</a>[dropdown]', $content ) : $content . '</a>';

I have problem resolved after replacing $dropdown with $atts['dropdown'] so it will look:

    $content = ( $atts['dropdown'] ) ? str_replace( '[dropdown]', '</a>[dropdown]', $content ) : $content . '</a>';

Regards

MWDelaney commented 9 years ago

Fixed by 752e0593c5f1608b474329b1918f84a0876d7e47