WordPress.org

Support

Support » Plugins and Hacks » Bootstrap Shortcodes for WordPress » [Resolved] Collapse / Accordion "start collapsed" issue

[Resolved] Collapse / Accordion "start collapsed" issue

Viewing 15 replies - 1 through 15 (of 17 total)
  • Plugin Author MW Delaney

    @foolsrun

    Hey mattboden,
    Sorry for the delay in replying, I was away for the holiday weekend.

    Thanks to your report I’ve tracked down a bug in the current version of this plugin. Setting the “active” parameter to any value, “true”, “false”, “dishwasher”, etc. will cause the collapse to display as “active”. To work around this issue just leave that parameter off the collapses you want to display collapsed.

    So while this will show all collapses open:

    [collapsibles]
    [collapse title="Collapse 1" active="true"]
    …
    [/collapse]
    [collapse title="Collapse 2" active="false"]
    …
    [/collapse]
    [collapse title="Collapse 3" active="dishwasher"]
    …
    [/collapse]
    [/collapsibles]

    This should work as you expect and only show the second one as open:

    [collapsibles]
    [collapse title="Collapse 1"]
    …
    [/collapse]
    [collapse title="Collapse 2" active="true"]
    …
    [/collapse]
    [collapse title="Collapse 3"]
    …
    [/collapse]
    [/collapsibles]

    We will fix this bug in an upcoming version. Thank you for your report and please don’t hesitate to write back if this doesn’t resolve your issue!

    Hi there,

    Thanks for getting back to me.

    Glad i helped to establish a bug, but mine is coming from elsewhere unfortunately (and i suspect related to my theme). With shortcode, no panels will collapse regardless of what i include, or don’t include. I also tested the full code for an accordion and whilst it works, it is running in reverse so “collapse in” keep a panel open, and “collapse” keeps a panel closed, which is opposite to what it should be doing. Very odd! Hopefully i can find the solution as it’s a shame such a handy feature for presenting content doesn’t work for me.

    Matt

    Plugin Author MW Delaney

    @foolsrun

    That’s an odd situation. Does the bug still present itself if you switch to one of WordPress’s default themes like 2014?

    I’m happy to keep working on this with you. If it turns out I can adjust the plugin for better compatibility with themes like yours I’ll do what I can!

    Thanks for offering support. I think if the longhand code correctly i’d say there might be something that could be done. I assume bootstrap is not core to 2014 and i’ll need to add it to check whether it works – i’ve not checked that as yet, but i’ll need to help isolate where the root of the problem might be.

    Plugin Author MW Delaney

    @foolsrun

    What theme are you using? Maybe I can test in a similar environment.

    Hi there,

    The theme used is http://themeforest.net/item/tendershop-responsive-easy-digital-downloads-theme/6758249 picked due to it being built using the bootstrap platform. I tested the ‘collapse’ with all plugins deactivated, but didn’t make a change, so not sure it’s the plugins. Leads me to believe it’s the theme. I’ll try and add bootstrap to 2014 to see if it works okay with that one.

    Thanks a million for your help.

    Plugin Author MW Delaney

    @foolsrun

    Matt,
    Give “Shoestrap” a try. It’s a very light-weight theme that has Bootstrap included. I’ve tested it successfully with this plugin.

    http://shoestrap.org/

    If that works OK for you, then I think we can narrow the problem down to the theme. I’ll have to figure out how we can work around it once we’ve done that.

    Plugin Author MW Delaney

    @foolsrun

    Hold that thought. I found the problem. The issue is definitely with your theme, specifically in this file:
    http://newsite.opalbroadcastingnetwork.tv/wp-content/themes/tendershop/js/script.js

    On line 1275 your theme does this:

    jQuery('.collapse').collapse()

    Which seems to be conflicting with this plugin’s preference for using data-attributes for collapse (see here for the difference).

    Commenting out line 1275 in /tendershop/js/script.js should fix the issue for now. I’ll see if I can figure out a way to work around the problem and correct for when a theme wants to fire the collapse() function this way.

    Hi

    Thanks again for taking the time to check out the issue.

    Is that the right file? That one doesn’t seem to go beyond 150 lines.

    I found the line and commented it out. It’s had the effect of stopping the longhand code from collapsing, and hasn’t made a change to the shortcode. They’re all still open.

    Plugin Author MW Delaney

    @foolsrun

    Ugh. The theme developer is reversing the way collapse is supposed to work.

    In /wp-content/themes/tendershop/style.css

    Comment out line 95 which should read as follows:

    .collapse { display: block }

    Then everything should work as expected.

    Thanks so much! The shortcode for collapse is working perfectly now too.

    Not sure why it was reversed, but i can’t see any adverse effects elsewhere on the site.

    Really appreciated!

    Plugin Author MW Delaney

    @foolsrun

    Glad it’s working now. I’ll investigate working around this kind of thing in the future and correcting for weird theme development.

    Thanks for reporting and I’m glad you like the plugin!

    maDe

    @madeinua

    If it’s possible please add class “collapsed” to accordion-toggle by default (if toggle isn’t active). Bootstrap does it automatically (try to open – close toggle).

    CURRENT:
    <a class="accordion-toggle" data-toggle="collapse" data-parent="#%3$s" href="#%4$s">%5$s</a>

    NEW:

    <a class="accordion-toggle' . ($active == 'true' ? '' : ' collapsed') . '" data-toggle="collapse" data-parent="#%3$s" href="#%4$s">%5$s</a>

    Plugin Author MW Delaney

    @foolsrun

    Thank you for reporting this. I see that the example at Bootstrap’s website does indeed include the “collapsed” class for non-active collapses. That must be new?

    I’ll add this to the list of things to add in the next release.

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘[Resolved] Collapse / Accordion "start collapsed" issue’ is closed to new replies.
Skip to toolbar