Support » Plugin: Collapsing Categories » [Plugin: Collapsing Categories] Javascript syntax error – causing expanding not to work fix

  • Sometimes there is an extra comma (depending on the widget settings) that is not addressed in the code and it is causing javascript error that prevents the widget from functioning – no expanding/collapsing.

    The bad comma is present in the call to this function:
    addExpandCollapse(‘widget-collapscat-4-top’,'<img src=”/wp-content/plugins/collapsing-categories/img/expand.gif” alt=”expand” />’, ‘<img src=”/wp-content/plugins/collapsing-categories/img/collapse.gif” alt=”collapse” />'<strong style=”color: red;”>, )

    To fix it (actually just to apply a workaround):
    in …/collapsing-categories/collapscat.php on lines 143-144
    replace this

    echo "addExpandCollapse('widget-collapscat-$number-top'," .
              "'$expandSym', '$collapseSym', " . $accordion . ")";

    With this

    $addExCol = "addExpandCollapse('widget-collapscat-$number-top'," .
              "'$expandSym', '$collapseSym', " . $accordion . ")";
          echo str_replace ( "', )" , "' )" , $addExCol );

    This workaround simply removes the “bad” comma.

Viewing 14 replies - 1 through 14 (of 14 total)
  • Just updated to the latest version and the bug is still there.
    Fix this bug already!

    vitialvital, I was excited when I saw your fix because I can’t get the plugin to expand. Unfortunately, your fix doesn’t fix it for me. I can’t get it to expand at all–so it’s just a list of top level links.

    Yea, I’m having an “unterminated string literal” error. It seems that there’s an issue with a quote….

    collapsItems['collapsCat-7:2'] = '<ul><li class=\'collapsing categories item\'><...

    According to firebug the issue is with the quote just before the ul tag. Any suggestions?

    yes, the auto collapsing does not seem to work anymore.. Anyway to fix this?

    the workaround does not work for me. any solutions for this yet?



    Hopefully this helps you guys, it worked for me:

    File: collapscatlist.php
    Lines: 259 – 261

    Original Code:

    $link2 .= 'title="' .
        $cat2->description,$cat2)) . '"';

    Change to:

    $link2 .= 'title=""';

    Works nice for me. All settings (from what I’ve tried) are working fine after this change too.

    …expanding not to work for me. 🙁

    wp 3.5 + Atahualpa 3.7.10


    Everything works fine, but one major problem.

    PROBLEM: If the main category level does not have a sub category level and you click on the parent category, it simply expands and collapses, it does not archive the content or listing of items in that parent category.

    Please help, I very much rely on this plugin.




    meetgerry, is this problem happening after you applied one of the previously mentioned fixes? Which one?

    Yes, I have replaced all the codes mentioned above. If the parent category has a level 1 or level 2 menu only then clicking on the parent category/menu shows the list of items. I am using this plugin on the left sidebar of the following website under the title “Collapsing Categories” please see.

    See the settings I have for the plugin:



    All the codes mentioned above? A few people posted different code to try and solve this.

    Anyway I dropped using this plugin in favor of a more simple list so I’ll just have to wish you luck in getting this solved and hopefully the original developer can fix this issue.

    This plugin works fine in all respects other than the listing of items from the parent category if it does not have a sub-category.

    Any idea what part of the code or file should be played with?



    If it’s a different issue than what this thread it about then you should start a new thread. I’m not sure what part of the code you would have to adjust.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘[Plugin: Collapsing Categories] Javascript syntax error – causing expanding not to work fix’ is closed to new replies.