Title: [Plugin: Collapsing Categories] Javascript syntax error &#8211; causing expanding not to work   fix
Last modified: August 20, 2016

---

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

 *  [Vital Urbonavi](https://wordpress.org/support/users/vitalvital/)
 * (@vitalvital)
 * [14 years, 4 months ago](https://wordpress.org/support/topic/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.
 * [http://wordpress.org/extend/plugins/collapsing-categories/](http://wordpress.org/extend/plugins/collapsing-categories/)

Viewing 14 replies - 1 through 14 (of 14 total)

 *  Thread Starter [Vital Urbonavi](https://wordpress.org/support/users/vitalvital/)
 * (@vitalvital)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/plugin-collapsing-categories-javascript-syntax-error-causing-expanding-not-to-work-fix/#post-2540066)
 * Just updated to the latest version and the bug is still there.
    Fix this bug 
   already!
 *  [TraciBunkers](https://wordpress.org/support/users/tracibunkers/)
 * (@tracibunkers)
 * [13 years, 9 months ago](https://wordpress.org/support/topic/plugin-collapsing-categories-javascript-syntax-error-causing-expanding-not-to-work-fix/#post-2540067)
 * 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.
 *  [Matt Barrett (corradomatt)](https://wordpress.org/support/users/corradomatt/)
 * (@corradomatt)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/plugin-collapsing-categories-javascript-syntax-error-causing-expanding-not-to-work-fix/#post-2540081)
 * 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?
 *  [wzshop](https://wordpress.org/support/users/wzshop/)
 * (@wzshop)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/plugin-collapsing-categories-javascript-syntax-error-causing-expanding-not-to-work-fix/#post-2540082)
 * yes, the auto collapsing does not seem to work anymore.. Anyway to fix this?
 *  [ctpweb](https://wordpress.org/support/users/ctpweb/)
 * (@ctpweb)
 * [13 years, 5 months ago](https://wordpress.org/support/topic/plugin-collapsing-categories-javascript-syntax-error-causing-expanding-not-to-work-fix/#post-2540088)
 * the workaround does not work for me. any solutions for this yet?
 *  [sk](https://wordpress.org/support/users/renegadesk/)
 * (@renegadesk)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/plugin-collapsing-categories-javascript-syntax-error-causing-expanding-not-to-work-fix/#post-2540091)
 * Hopefully this helps you guys, it worked for me:
 * File: collapscatlist.php
    Lines: 259 – 261
 * Original Code:
 *     ```
       $link2 .= 'title="' .
           wp_specialchars(apply_filters('description',
           $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.
 *  [teresax](https://wordpress.org/support/users/teresax/)
 * (@teresax)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/plugin-collapsing-categories-javascript-syntax-error-causing-expanding-not-to-work-fix/#post-2540092)
 * …expanding not to work for me. 🙁
 * wp 3.5 + Atahualpa 3.7.10
 *  [meetgerry](https://wordpress.org/support/users/meetgerry/)
 * (@meetgerry)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/plugin-collapsing-categories-javascript-syntax-error-causing-expanding-not-to-work-fix/#post-2540095)
 * Hello,
 * 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.
 * Thanks
    Gerry
 *  [sk](https://wordpress.org/support/users/renegadesk/)
 * (@renegadesk)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/plugin-collapsing-categories-javascript-syntax-error-causing-expanding-not-to-work-fix/#post-2540096)
 * meetgerry, is this problem happening after you applied one of the previously 
   mentioned fixes? Which one?
 *  [meetgerry](https://wordpress.org/support/users/meetgerry/)
 * (@meetgerry)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/plugin-collapsing-categories-javascript-syntax-error-causing-expanding-not-to-work-fix/#post-2540097)
 * 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.
 *  [meetgerry](https://wordpress.org/support/users/meetgerry/)
 * (@meetgerry)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/plugin-collapsing-categories-javascript-syntax-error-causing-expanding-not-to-work-fix/#post-2540098)
 * See the settings I have for the plugin: [http://postimage.org/image/a8t10umg5/](http://postimage.org/image/a8t10umg5/)
 *  [sk](https://wordpress.org/support/users/renegadesk/)
 * (@renegadesk)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/plugin-collapsing-categories-javascript-syntax-error-causing-expanding-not-to-work-fix/#post-2540099)
 * 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.
 *  [meetgerry](https://wordpress.org/support/users/meetgerry/)
 * (@meetgerry)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/plugin-collapsing-categories-javascript-syntax-error-causing-expanding-not-to-work-fix/#post-2540100)
 * 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?
 *  [sk](https://wordpress.org/support/users/renegadesk/)
 * (@renegadesk)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/plugin-collapsing-categories-javascript-syntax-error-causing-expanding-not-to-work-fix/#post-2540101)
 * 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.

 * ![](https://ps.w.org/collapsing-categories/assets/icon-256x256.gif?rev=2886482)
 * [Collapsing Categories](https://wordpress.org/plugins/collapsing-categories/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/collapsing-categories/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/collapsing-categories/)
 * [Active Topics](https://wordpress.org/support/plugin/collapsing-categories/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/collapsing-categories/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/collapsing-categories/reviews/)

 * 14 replies
 * 8 participants
 * Last reply from: [sk](https://wordpress.org/support/users/renegadesk/)
 * Last activity: [13 years, 4 months ago](https://wordpress.org/support/topic/plugin-collapsing-categories-javascript-syntax-error-causing-expanding-not-to-work-fix/#post-2540101)
 * Status: not resolved