Collapsing Categories
Javascript syntax error - causing expanding not to work + fix (15 posts)

  1. Vital Urbonavi
    Posted 4 years ago #

    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.


  2. Vital Urbonavi
    Posted 3 years ago #

    Just updated to the latest version and the bug is still there.
    Fix this bug already!

  3. TraciBunkers
    Posted 3 years ago #

    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.

  4. Matt Barrett (corradomatt)
    Posted 3 years ago #

    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?

  5. wzshop
    Posted 3 years ago #

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

  6. ctpweb
    Posted 3 years ago #

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

  7. sk
    Posted 3 years ago #

    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.

  8. teresax
    Posted 3 years ago #

    ...expanding not to work for me. :(

    wp 3.5 + Atahualpa 3.7.10

  9. meetgerry
    Posted 3 years ago #


    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.


  10. sk
    Posted 3 years ago #

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

  11. meetgerry
    Posted 3 years ago #

    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.

  12. meetgerry
    Posted 3 years ago #

    See the settings I have for the plugin: http://postimage.org/image/a8t10umg5/

  13. sk
    Posted 3 years ago #

    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.

  14. meetgerry
    Posted 3 years ago #

    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?

  15. sk
    Posted 3 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Collapsing Categories
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic