Collapsing Categories

The collapsing categories plugin creates a list of all categories, subcategories, and posts, which can be expanded and collapsed dynamically, as you can see in the sidebar on this page.

The plugin is hosted on the official WordPress repository at: http://wordpress.org/extend/plugins/collapsing-categories

If you have any questions, bug reports, or feature requests, please visit the Frequently Asked Questions, and at the other comments here (find is your friend)).

Your appreciation

If you really like my plugins, please give them a nice ranking in the wordpress plugin repository (links above), or you can send me a donation via paypal below:




240 Responses to Collapsing Categories

  1. robfelty says:

    @Star – I have been unable to reproduce that error, so I don’t know how to fix it. However, you can set the options from the widget page. Starting with version 0.6 and up, this will be the only way to set options. There are options for sorting categories and posts.

    Rob
    p.s. there are a couple bugs in 0.6. 0.6.1 will be released soon. If you want to preview it, check out the development version.

  2. Hans says:

    @star: I use my-page-order and ‘my-category-order’ from the same author, and the settings made there, are accepted or can be selected in ‘collapsing categories’.

    The page order or category order widgets need not even be used in the sidebar; their settings are found under “Manage” on the dashboard.
    Hans

  3. Andy says:

    Hi Rob!
    Me again, I have no chance to make your new version work in “tabbed widgets” though the old version worked. AND I can make it work within “tabbed widgets” if I have an ADDITIONAL copy of the widget outside of tabbed widgets. So there must be some option-saving problem? I’ve tried to de-activate and everything, nothing helped. By the way: the images +/- are great but actually the [-] didn’t work, it just stays on [+]…

  4. robfelty says:

    @Andy – I wish I could fix this for you, but I can’t figure it out. It seems to be a pretty complicated interaction. I am using WP 2.6.2 on this blog, with collapsing-categories 0.6.1, and I just added tabbed-widgets 0.73, and as you can see, it works. I have a few test blogs as well:

    http://robfelty/test26/
    uses WP 2.6, and tabbed widgets work there
    http://robfelty/test261
    uses WP 2.6.1 and tabbed widgets work
    http://robfelty/test
    uses WP 2.6.2, and tabbed widgets don’t work, no matter what widgets I put in them.

    I would be happy to help you get it working, but I will need some more info. What version of WP are you using? And does it have something to do with your theme?

    I will look into the [-] image issue. Thanks for pointing that out.

  5. robfelty says:

    @Andy – I fixed the image issue in 0.6.2. I also investigated the tabbed widgets a bit more. Now I finally understand what you are saying. However, I believe this is actually an issue with the tabbed widgets plugin. For example, if you try to add a basic text widget, the same problem occurs. Basically, the problem occurs for any widget that allows multiple instances of it. Several people asked for this functionality, and it required a major rewrite of the code.

    Interestingly enough, if you add a text widget both inside and outside of a tabbed widget, then it will show up in the tabbed-widget. The same goes for collapsing categories. This makes me think it should be possible to get it to work, but I think that it is the tabbed widgets plugin which should support widgets that support multiple instances. I used the recommended template directly from the widgets.php file to create the 0.6 series of collapsing categories.

    Rob

  6. Ray says:

    Rob,

    How can I eliminate the line spacing between categories?

    thanks,
    Ray

  7. Gus says:

    Great plugin! I love that you can sort posts by the number of comments. But is there a way to also show the # of comments next to each post?

  8. Rick says:

    Hey, Rob …

    I haven’t been able to use collapsing categories since upgrading to 2.6.1. I just downloaded and installed 0.6.2 and it didn’t help. It is activated, but doesn’t show up on my sidebar. It worked fine for months before the upgrade.

    Thanks for any advice. I love your plugins.

  9. robfelty says:

    @Ray – Add a line to the collapscat.css file in the .sym class, like so:

    .sym {font-family:monospace;
          font-size:1.5em;
          line-height:1.5em;
          padding-right:5px;}
  10. robfelty says:

    @Rick – try disabling then re-enabling the plugin.

  11. Yick says:

    There seems to have a bug in the include/exclude option, i try to exclude with catid, catslug and catname. none seen to work. it is the same for expand option. Can you pls kindly show me the exact syntax to exclude, expand certain cat. I know it should work because it work on your example of the left.

    Help much appreciated.

  12. robfelty says:

    Yick,

    All you have to do is enter a list of category names separated by commas. For example, if you want to exclude foo, bar, and cat with spaces enter:

    foo, bar, cat with spaces

    Rob

  13. Yick says:

    Thanx for your quick response! I know why it doesn’t work already.

    I do more test, I successfully expand the categories with catslug. (with catname with space in them) When I do catslug or catname on exclude, it doesn’t work if the catname has space.

    For example,
    Catname:Health, catalug:health, it successfully excludes
    Catname:Article and Tips, catalug:articlestips, it does not exclude

    I believe it is a bug. Please check it out.

  14. Andy says:

    Hmmm, there is still this big problem with “Tabbed Widgets”-plugin. Everything works fine as long as there is an additional widget of collapsing categories running, but the implementation doesn’t work if I only implement your plugin in the collapsed widget. Everything worked fine with 0.5.2

  15. Gus says:

    Hi Rob,

    Is there a way to display the # of comments next to each post?

  16. Rob says:

    @Andy – You are correct. However, what I am saying is that this problem is not just with collapsing categories, but also with the default text widget that ships with wordpress, and any other widget that follows that template. I could not get the text widgets to work at least. I would suggest asking the tabbed widget author about it.

    @Gus – not yet. I will implement this soon.

  17. Andy says:

    Strange. the normal text widget works without problems in my config.. Anyhow, another question: do you know the very cool plugin “widget cache”? It implements additional options to the widgets to create a cache. These options don’t show up in your two widget but in all other. Maybe you could take a look. Thanks!

  18. Andy says:

    Hi again, Rob! Everything works fine now… thanks a lot for the effort. One question though.. are you gonna update the collapsing archives plugin that it uses the same images as + – ?

  19. robfelty says:

    Andy,

    Glad to hear that things are working fine. I am a bit curious what changed, since I haven’t changed anything in about a week.

    I am working on an update to the collapsing archives plugin, and it will have the new features of collapsing categories, including the images option.

  20. Ruben says:

    Hi, I really LOVE this categorie widget. Only thing I don’t really like is the ‘waste of space’, but I’m not sure if this is because of your widget or just my site stylesheet. I mean, it now displays like this:

    +/-
    Categorie name
    (posts)

    …and I rather just have…

    +/- Categorie name (posts)

    Any idea on how to change this? Could not find any line-returns in the code.

  21. robfelty says:

    @Ruben,

    Without a link to your site, I can’t provide that much help. My suggestion is to make sure you have the latest version 0.6.2.

    Rob

  22. Ruben says:

    Never mind my previous question. Just tried another theme and it looks fine. So I’ll just have to dive into the theme’s CSS I think. Thanks again for this great widget!

  23. Jeff says:

    Hi,

    I just activated the plug in and found it on the widgets list, but I tried many times to add the Collapsing Categories widget still unsuccessful. When I press ‘Add’ then ‘Update’, the widget remove itself!

    I go to check my css and seem it’s ok
    http://mysite/wp-content/plugins/collapsing-categories/collapsCat.css

    Any suggestion for me, thank you

    Jeff

  24. Rob says:

    @Jeff – what version of wordpress are you using? The plugin (version 0.6+) requires at least 2.6

  25. Jeff says:

    Hi Rob, I’m using wordpress 2.5, will update to 2.6 and try again. Thank you

  26. Philip says:

    Hi Rob
    The latest version of the plugin (0.6.3) seems to make the display of the RSS logo compulsory. Even though I select the “none” option, that radio button de-selects itself as soon as I press “Change”. And the default behaviour when no options are selected seems to be to display a whole load of orange logos down my sidebar.
    http://test.londonkoreanlinks.net/

  27. Robert Felty says:

    @Philip – thanks for noticing that. I fixed it. Please re-download 0.6.3

    Rob

  28. William says:

    Nice widget. I like the collapsible idea..in that it helps some sites keep annoyingly long lists shorter. In which I need to ask…. Can I use this widget for collapsing my “blogroll” categories and links? I’m not exactly knowledgeable in code. BTW can’t the little arrow ( i seen a comment based on ) be resized in css? I have some sites Rss/Atom feeds that I respect and would like collapsed and a blogroll that might get somewhat longish… It seemed as though it would of been a given by WP that it would be there with a tickable box. Thanks

  29. Chris says:

    First of all thanks to your very good plugin.
    Just one minor thing I wanted to improve:
    I prefer that the choosen category stays open when clicked, so I added
    the lines below at collapscatlist.php at line ~288.
    You can see how it works at http://www.physik-versuche.de .
    If you like it, you can add it to your code.

    Would be nice if you answer to this mail, just that I know you got it and no spam filter ate it.

    Thanks for your work. – Please delete this comment.

    if ($defaultExpand!=”) {
    $autoExpand = preg_split(‘/,\s*/’,$defaultExpand);
    } else {
    $autoExpand = array();
    }
    //New content
    if (is_category()==true) {
    //collapse current category
    $cat = get_the_category(); $cat = $cat[0];
    array_push($autoExpand, $cat->cat_name);
    $parentkategorien=explode(“]|[“, (get_category_parents($cat, false,’]|[‘,false)));
    $autoExpand=array_merge($parentkategorien,$autoExpand);
    }
    //End of new content

    echo “\n \n”;

  30. Twincascos says:

    Hello Rob,
    I’ve just made a deviation of your plugin, I take it that you will be ok with that.
    I’ve made it work with Mootools instead of jquery. I’ve also switched it from an unordered list to a data list. I do give you credit for the code, and I have removed various options which yours has, have a look and let me know if you have any problems with my usage. Thanx for your time. http://wp-superslider.com/superslider-menu

  31. sonyanews says:

    Hi there. I really like this plug-in, but I’m curious if you have a version for wordpress MU. Thanks for any help offered.

  32. Chris Berry says:

    I just installed 0.6.3 and I love it. I do have one small problem that I hope you can solve. I can’t get the rss icon to go away. I can switch between the text and the icon, but when I choose none I still get the icon. I’m on WP 2.6.

  33. robfelty says:

    @Sonyanews – I know nothing about MU (except that it exists). Any advice on what a MU version would be like?

    @Chris – hmmm, I thought that I fixed this bug, and I just tried downloading the plugin again, and the fix seems to be there. Try downloading it again. If that doesn’t work, try uninstalling and re-installing the plugin. And if that doesn’t work, I can try to help you figure it out. I like your blog layout by the way.

    Rob

  34. Oracle says:

    Thanks for the great plugin. However I found that when I have plugin manager plugin or with Minimeta plugin installed, installing collapsing cat plugin would yield to error 500 to the plugin page. I have to delete the collapsing cat plugin in order to fix the problem. Am I the only one here?

    Thanks again for your hard work.

  35. robfelty says:

    @sonyanews – I finally got around to playing around with wordpress mu. I set up a test site at http://robfelty/testmu, and both the collapsing archives and collapsing categories plugins seem to work just fine out of the box. They display the categories and archives only for each blog. Were you looking for something that would show the archives and categories for all the blogs combined?

  36. rob says:

    Hi, I like your plugin, but recently when i upgraded from 2.6.2 to 2.6.3 of WordPress MU, I lost the options screen where I can configure things. I’m looking to exclude certain categories from appearing, but can’t find the main options screen.

    Can you help me out?

  37. Robert Felty says:

    @rob – what version of collapsing categories are you using? If you are using version 0.6+ then you can only access the options through the widgets page. Soon I will be bringing back the normal options page as well. I only recently figured out how to add both multiple instances of the widgets, and a non-widget version.

    Rob

  38. rob says:

    @robfelty I’m using version 0.6.4 of Collapsing Categories and can only change the following in Design > Widgets:

    Title
    [] Show as dropdown
    [] Show post counts
    [] Show hierarchy

    What I need to do right away is exclude a category from the dropdown I’m using. Is there a way I can do that in the database manually?

  39. robfelty says:

    @rob

    Those are the options for the standard categories widget. You need to add the “collapsing categories” widget. The plugin does not replace the categories widget, but rather adds the option for an additional widget.

    You don’t want to exclude stuff in the database directly. You want to exclude it in your sql query, which is what my plugin does.

    Rob

  40. rob says:

    *smacks forehead* D’oh! That’s why I was confused. Thanks.

  41. rob says:

    Sorry, but I’m still having problems even after using the Collapsing Categories widget. When I type a valid cat_ID, cat_name, or category_nicename (slug) into the Exclude text box, and then click “Change” and “Save” in Widgets, the page still shows the category name I excluded.

    So, for example, I typed (in three separate attempts:

    388
    People Spotlight
    people-spotlight

    and the category still appeared in the list. What am I not doing right?

    Thanks.

  42. amenity says:

    Okay, I really shouldn’t jinx it…But I’ve just installed this plug in and think its brilliant. Just one problem: where can I donate?
    Thanks for your work.

  43. robfelty says:

    @Rob – Do you have any sort of caching on your site? That could be the problem. Excluding works by category name (or category slug). It works fine for me on this blog (I just tested it).

    @Amenity – Whoops, I guess I forgot to include a donate link in this page (I have one for collapsing archives). I just added it. Thanks

  44. rob says:

    I haven’t done any custom caching on our site. Just what comes with WordPress MU. Which settings should I check with WordPress MU?

  45. Martin says:

    Hello Rob,

    this plug-in is exactly what I need :)

    I have one question. If I click on some subcategory I can see posts what I want – its perfect but after I click on this subcategory the whole categories closes. Is there any choice and the categories would stay collapsed(Opened) on my last click? Thanks

  46. Robert Felty says:

    @Martin,

    That feature has been requested several times, and I do plan to implement it in the future, but it might be a while. Stay tuned for updates.

    Rob

  47. Robert Felty says:

    @Martin,

    Actually, I just implemented it. (It is not an option, it just does it.) I currently have it in the development version. Please try it out and see what you think.

    Rob

  48. Martin says:

    Hi Rob,

    Thanks for yor fast reacion. Where can I download your development version with this functionality? Thanks. Martin

  49. Martin says:

    Rob,

    finally I have found your development version. I deleted old directory collapsing-categories and uploaded the new one (development version). Then I tried to load my pages but it freezes my explorer. After I did recopy the old version it worked. I think the problem is in collapscat.php because then I tried to replace everything in steps by routines and after copy every routine I tried my pages. After copy of collapscat.php the pages freezes.

  50. robfelty says:

    @Martin,

    As is to be expected, Internet Explorer (IE) always does things differently. It was quite trivial to get things working for Firefox, but there was a lot of guesswork to get it to work for IE. I have tested it with IE 6.0 now, and that seems to work. Please try downloading the development version again, and see if that works for you. Please also let me know what version of IE you are using.

    Ro