WordPress.org

Support

Support » Plugins and Hacks » Shortcodes Ultimate » [Plugin: Shortcodes Ultimate] Close the accordion

[Plugin: Shortcodes Ultimate] Close the accordion

Viewing 5 replies - 1 through 5 (of 5 total)
  • Any help ?

    Hi bretonargentin,

    Try this… it seems to work (although I would really like to see it in the actual plugin!):

    1. Go to the "wp-content/plugins/shortcodes-ultimate/js/" folder
    2. Important: Back-up the "init.js" file
    3. Open the "init.js" file in your favourite HTML editor
    4. On lines 18-23, look for the following block of code:
      if ( spoiler.hasClass('su-spoiler-open') ) {
          if ( !isAccordion ) {
              content.hide(200);
              spoiler.removeClass('su-spoiler-open');
          }
      }
    5. Just after the } on line 23, add the following code:
      else {
          spoiler.parent('.su-accordion').children('.su-spoiler').removeClass('su-spoiler-open');
          spoiler.parent('.su-accordion').find('.su-spoiler-content').hide(200);
      }
    6. Save the file
    7. Test the open and close.

    That seems to work for me. You may want to test the “Spoiler” functionality to make sure it works the way you want it to as well.

    For my purposes, I only use the accordion and this tweak works okay. I hope that helps solve your issue.

    Remember: The only downside is, you must backup these changes… because if the plugin is automatically updated, then you’ll lose the changes you’ve just added.

    Hopefully, this change will be added and updated in the next version of the plugin… fingers crossed!

    Cheers,

    Zain

    Thanks Zain but I already have this code in the file.
    I use 3.7.0 version

    I don’t know how to fix this issue…

    Hi bretonargentin,

    I’m using 3.7.0 as well – this code won’t be in your file (as it’s a tweak I made so the tabs would close!).

    Anyway, just to clarify, it may look like you already have this code but actually, it’s the part after line 23 that you need to make.

    Lines 18 – 24 will look like this:

    if ( spoiler.hasClass('su-spoiler-open') ) {
        if ( !isAccordion ) {
            content.hide(200);
            spoiler.removeClass('su-spoiler-open');
        }
     }
     else {

    You will need to change lines 18-24 so that it now reads:

    if ( spoiler.hasClass('su-spoiler-open') ) {
        if ( !isAccordion ) {
            content.hide(200);
            spoiler.removeClass('su-spoiler-open');
        } else {
            spoiler.parent('.su-accordion').children('.su-spoiler').removeClass('su-spoiler-open');
            spoiler.parent('.su-accordion').find('.su-spoiler-content').hide(200);
        }
     }
     else {

    As you can see, I’ve just used the same code to close but this time what is does the function checks to see if it’s already open.

    Like I say, it seems to work for me.

    Good luck!

    Cheers,

    Zain

    @zainb You got it right. At first i also thought it was already there but thanks to your ‘before’ and ‘after’ comparison.

    Again, thank you.
    Dreb

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: Shortcodes Ultimate] Close the accordion’ is closed to new replies.
Skip to toolbar