WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. vitalvital
    Member
    Posted 2 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.

    http://wordpress.org/extend/plugins/collapsing-categories/

  2. vitalvital
    Member
    Posted 2 years ago #

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

  3. TraciBunkers
    Member
    Posted 2 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)
    Member
    Posted 1 year 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
    Member
    Posted 1 year ago #

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

  6. ctpweb
    Member
    Posted 1 year ago #

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

  7. sk
    Member
    Posted 1 year ago #

    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.

  8. teresax
    Member
    Posted 1 year ago #

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

    wp 3.5 + Atahualpa 3.7.10

  9. meetgerry
    Member
    Posted 1 year ago #

    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

  10. sk
    Member
    Posted 1 year ago #

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

  11. meetgerry
    Member
    Posted 1 year 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
    Member
    Posted 1 year ago #

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

  13. sk
    Member
    Posted 1 year 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
    Member
    Posted 1 year 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
    Member
    Posted 1 year 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

About this Topic