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:

    @Jeff – I have updated the installation instructions in the readme. I know about this issue. A temporary workaround for WP 2.7 is to add the widget, then save, then select “show unused widgets”. It should be there, and you can add it fine from there. I am working on figuring out the real solution, but it is quite elusive.

    Rob

  2. zak says:

    firstly,greet plugins

    but when i updated all collapsing plugins in 2.7,they seems dont work as a widget…

  3. tim says:

    hi rob, the site isnt live yet at the moment, the error happens on every page the widget is shown on and ie reports an error in the bottom left screen. also it appears the animation is a little buggy at times in ie.

  4. Rob..
    When I chose sort by category Term order all of the categories dissappear from the main page

    why is that

  5. Jeff says:

    Hi Rob,

    Thanks for updating your read me. I can get the Colalasping Category plugin to work when I select the “show unused widgets” item in the widgets window. The interesting thing I noticed is that I have 6 instances of the widget listed as unused. My guess is that I’ve tried to add the widget 6 times (I didn’t actually count, but that seems about right). If I uninstall the plugin and reinstall it the 6 instances remain which tells me that something is being stored in the database somewhere and not getting removed. Let me know if I can help debug any further.

  6. DarrenH says:

    Rob – Thanks for the great plugin. However, I can’t seem to get it working fully. I can see the collapsed categories, but I cannot expand them. I am running WP2.7 locally on my Mac (creating an overhaul of my existing website before I post it to the web). I am running the very latest (0.8) of your plugin, looks like it was just posted before I downloaded it. I am not using the widget feature. I am just dropping the hook code into my sidebar.php per your suggestion in your documentation. Any suggestions?

  7. robfelty says:

    @Iraqgoals – I fixed sorting by term order. Please download the development version. It will also be included in 0.8.1, which should come out in a couple weeks.

    Rob

  8. Philip says:

    Hi Rob, me again
    0.8 doesn’t seem to work (for me at least) in IE 6, nor in the latest Firefox (that is, the categories don’t expand).
    To be honest, I don’t expect most things to work in Firefox which is why I hardly ever use it, but I usually expect things to work in IE6.
    It’s fine in IE7, and the latest releases of Seamonkey, Flock, Opera and Safari.
    Best
    Philip

  9. robfelty says:

    @Philip,

    interesting. Your site with 0.8 works fine for me in Firefox 3.0.5 and Safari 3. I mostly test on Firefox, and expect things to work there, but less so on IE of any sort. I find developing for IE very difficult, as it doesn’t give you much information. But I like things to work everywhere. You’re not the only one who has reported problems. Hopefully I will be able to figure things out soon.

    Rob

  10. Philip says:

    Yes, don’t fret too much about Firefox: the problem’s more with me. I’m sure it works fine, but I’ve never worked out how to configure the blasted thing (Firefox, that is) so that simple things like youtube videos will appear ^^. IE6 is more of a pain though as so many people seem to be on it still.
    Cheers.

  11. robfelty says:

    @Philip, seems to work fine for me in IE6. Try a hard page refresh (not from cache), with shift+refresh. It might be that the browser is using a cached version of collapsFunctions.js

    Rob

  12. thanks rob i will try it and let you know

  13. DarrenH says:

    Hey Rob – just checking to see if you had any idea why the category list will not expand as I had stated earlier. any help would be greatly appreciated. thanks!

  14. Philip says:

    Yes Rob you’re right. A hard page refresh and IE6 is working fine. Even my Firefox is working now!
    Happy holidays to you
    Philip

  15. robfelty says:

    @DarrenH – try a hard page refresh (shift + refresh)

    If that doesn’t work, send me a link.

    Rob

  16. DarrenH says:

    Rob – still not working and unfortunately, I can’t send you a link, because I’m building it locally. Any other suggestions?

  17. Jessie Angel says:

    First I’d like to say: “Great plugin!”

    It works very well on my site: http://www.voodooenvy.com/.

    However, I am having an small issue with it. All my categories are duplicated on the page. How can I fix this?

    I am using the following code on my sidebar:

                                        <?php
         if( function_exists('collapsCat') ) {
          collapsCat('%i%');
         } else {
          echo "\n";
          wp_list_categories();
          echo "\n";
         }
        ?>

    I was using the wp_get_categories option before, but I kept getting an error message, so i used the wp_list_categories instead and it works fine.

  18. robfelty says:

    @Jessie,

    Nice site! The styling on your collapsing plugins looks great. I am not sure why the categories are showing up twice. Have you modified the code at all? It looks like it is simply printing out each twice. The other possibility is that they might be duplicated in your database. Sorry I am not more help. Let me know if you figure it out.

    I will also update the readme file on the installation about the wp_list_categories. Thanks.

    Rob

  19. Jessie Angel says:

    @robfelty,

    Thank you so much for your response.

    I did check my database out, but I still can’t figure it out. I remember this issue happened even before I updated the plugin.

    If I figure it out, I will let you know.

    Thanks!

  20. Dave Jackson says:

    Hi Rob,

    This would be wonderful if I could get it working. I installed the plug-in and my template is not-wigitable, so I am using your instructions for manual install – however, it seems to be missing some code… Like maybe a closing bracket – but I don’t know where to put it.

    The error is Parse error: syntax error, unexpected ‘}’

    What is the correct code for a manual install?

    Thanks a bunch! BTW, the wordpress site really fudged up the manual code – but I found it in your readme file. Still no go. Thanks for any help.

    Kind regards,
    Dave Jackson

  21. John Bunting says:

    It is great plugin that I regard as essential. After updating to WP 2.7 although it still works in existing WP setups I cannot get it to install in the Widget page in admin.

    I click to add and it moves over to the right hand side but when I press Save Changes it vanishes off the right hand side again and does not appear on the post page on the site. Interestingly the system thinks it is still there as it is included in the number of widgets used on the Widget page. To reduce the count on the Widget page I have to add it again and then remove it before saving changes.

    I have tried this on more than one fresh installation and with different themes.

    The WP update was using Fantastico but I have found no other problems – yet!

    Any thoughts?

    John

  22. Stef says:

    Same problems here – I eventually got both Collapsing Categories and Collapsing Links working fine on WP 2.6.3, and they continued to work after I updated to WP 2.7, but as soon as I tried to save settings after another wigdet update, both disappeared from the sidebar. They’re both latest-issue and are both still visible in the list of available widgets, but they won’t stick when I add them to the sidebar. Tried the dev release too but it made no difference.

    This is a great shame, because the Collapsers were the best sidebar space-savers that I’d ever used, due to the way that they handled the huge number of links that I have.

    Hopefully you’ll come up with a fix soon, Rob.

    Cheers,

    Stef

  23. Rob says:

    @John, @Stef —

    I am aware of this issue, and included instructions in the readme for a temporary workaround for wp 2.7. If you select “show unused widgets”, you will see “collapsing categories” there, and if you add it, then save, the changes will stick. I spent about 4 or 5 hours trying to figure this out, but have not figured it out yet. I think it will ultimately take me a day or so, but I probably won’t find that day for another week or two. I apologize for the inconvenience.

    @Dave,

    This works for me:

    <?php collapsCat('%i%') ?>

    I hope it will work for you too.

    Rob

  24. Stef says:

    Hmmm…

    Went to “show unused widgets” and found 20 x Collapsing Links and 20 x Collapsing Archives listed on the left. None of them will add to the “current widgets” column on the right, and there’s no “save changes” button there anyway.

    At the bottom of the left column is a bit of code that seems vaguely familiar: %BEG_OF_TITLE%mvp%END_OF_TITLE%

    I’ve ditched Collapsing Categories as I no longer need it, but the others are keepers

    I’ll wait for a proper fix, but there’s no rush, it’s chill-time!

    Cheers for the reply, Rob.

  25. Stef says:

    FWIW, I’ve sussed the inability to add from the “unused widgets” screen – I disabled the WordPress.com stats helper plugin ( http://vlad.bailescu.ro/wordpress/plugin-stats-helper-functions-and-widgets/ ) which was responsible for the “mvp” code glitch, and it then allowed adding and saving. After resetting the options in both Collapsing Archives and Links widgets, I reactivated the rogue plugin and it’s all holding together at the moment.

  26. John Bunting says:

    Thanks for reply Rob. Must try reading Readme.txt files in future :-( . Good news is that it worked. Great! I only found 13 unused CC links! Not complaining, I’m just happy. I must learn to do a manual install.

    Liked your recipies (& philosophy) as another 95% vegan. I regularly do a simple humous with loads of garlic ;-) – will try yours. Will try rye bread once I succeed in making a starter that works.

    John

  27. John says:

    I recently upgraded and now I am not able to see the categories on my sidebar even though they are there in the widget area in Admin. Hopefully a fix can be found soon, I do like this plugin.

    John

  28. Jessie Angel says:

    Hi there! Happy New Year!

    Sorry to say, but I had to deactivate collapsing categories because it kept giving me a double entry for my categories. As soon as I did that, my categories seemed to work fine.

    What do you think the issue is. I did check the database and that seemed to be okay as well. I’ve looked at the code and I just can’t figure it out…. help?

    http://voodooenvy.com

  29. Loulou says:

    Hi :)
    Your plugin sounds great so I installed it :)
    But each time I configure the widget, it turn back by itself back from the list of widget of the sidbar :(
    I ‘m at servage.net hoster, autoinstalled wordpress 2.6.2 but somewhere I saw an automatic analyser telling me 2.7 …
    please is there any suggestion?

  30. robfelty says:

    @John,

    Sorry you are having problems. I can’t really offer much advice without seeing your problems in action. I like to keep a test site where I can test out new plugins (and develop my own), which uses much of the same database as my real blog. I would be happy to help you if you set up a test site.

    @Jessie,

    Since you seem to be comfortable with looking at the code, try inserting the following debugging code into the collapscatlist.php file on line 325 or so (right after the 2 “get_results” functions).

      echo "<pre>";
      echo "$postquery\n";
      print_r($posts);
      echo "$catquery\n";
      print_r($categories);
      echo "</pre>";

    This will show you exactly what the database query is and the results of it. If you see doubles here, then there must be something to do with the database (or the query).

    @LouLou,
    See the installation instructios in the readme.txt file. There is a workaround for this in WP 2.7

  31. Loulou says:

    oh god, thanks for your answer but i’m absolutly new in wordpress and does not know at all all about php
    each time I have a bug with my wordpress, I take 2 days to correct it and connection is very expensive here in lebanon, so very very thanks for your ideas, But i’m too afraid of making a mistake and taking much much time to resolve it :)
    in all case, your widget was a great cute idea :)

  32. watson says:

    I was using CC with WP 2.6 and it worked well. Upgraded to WP 2.7 and CC .8 and now I can’t get CC to work (list of categories do not show up in the CC widget area of the sidebar). I tried the “show unused widgets” trick but this did not help. Tried deactivate/reactivate, uninstall and reinstall, but no luck.

    In the widget area, for some reason there are (8) CC widgets being unused.

    Would like to try the following but need to know exactly where (between what other code) I should put this following code into the sidebar.php file:
    ——
    <?php
    if (function_exists(‘collapsCat’)) {
    collapsCat(‘%i%’)
    } else {
    echo “\n”;
    wp_get_categories(your_options_here);
    echo “\n”;
    ?>
    ——–

    Thanks for any help. Really enjoyed the plug in when I had WP 2.6. Hope to get it working again. Cheers and happy new year
    Jay

  33. Anaxagoras says:

    Hello,

    i have a one issue. I have WP 2.7 and latest plugins Collapsing Categories and Archives. But two weeks ago collapsing categories started just showing the name of the widget and no categories. So i dissabled the widget and enabled again but it started to disapper from the active widget list after i saved changes. So i deactivated the plugin and deleted it from ftp. I went to wordpress.org, downloaded it again, extracted it again to my wordpress plugins folder, then went to plugins page in wordpress admin area but it is not showing there. Neither it is not showing on FTP after, so it seems that WP is deleting it by itself :-( any ideas ? Thanks for any help. Best regards

  34. Anaxagoras says:

    So i get it work like it was. It is showing just name of the widget at the main page of my blog, but no categories inside. When i look into widgets managing at WP i can see 5 unused widgets of Collapsing Categories, which i tried to appear at the main page but it was constantly disappearing :-( any suggestions ?

  35. robfelty says:

    @Watson,
    After selecting “show unused widgets”, did you try adding one of those 8 collapsing categories widgets to the sidebar, then clicking on “save changes”? That is what works for me. Sorry if the instructions weren’t clear.

    @Anaxagoras,
    What sort of settings do you have for collapsing categories? Collapsing Archives seems to be working okay on your site.

    Rob

  36. watson says:

    Hi Rob,
    Yes I did add one (and tried more than one) of the CC widgets to the sidebar. Like others have mentioned here, the widget in the sidebar only showed the name of the widget and no categories were listed inside (below the widget name). I tried a combination of options inside the CC widget with no progress.

    Settings: show post count, sort by category name, sort posts by date, expanding shows sub categories and posts, clicking links to archives, auto expand = blank, include/exclude = blank (note: would like all categories to be included and have tried to manually include with cat names but no progress) , animate = off, include RSS = none, style info = blank.

    Still no progress. Do I need to enter any code in my sidebar.php file? If so exactly where should I try to put this info (which lines)? Thanks for any help.

  37. Rob,
    I decided to give a couple of your other plugins a go, once I got the Collapsing Links working the way I wanted. I installed Categories, placed the widget in my sidebar and it shows up. But it has all of my categories nested under each other. Since I only have 2 child categories, this doesn’t make much sense.

    Also, I have your Collapsing Links, Archives (Working well, BTW), and Categories in the same sidebar. If the Archives widget is below the Categories widget, the Archives do not show up in the sidebar at all. If the Category widget is on the bottom, both show up, but the Categories are messed up as I mentioned and the text widget I have at the bottom of the sidebar is added to the Category lists. And I can not get posts to show up under any of the categories, no matter how I set the options.

  38. Mitch Berger says:

    Hi,

    I use collapsing archives and categories. The first is working well (and thanks for folding in my fix for a sparse year), but collapsing categories is failing to produce any rows. So, I turned on debugging. The failure appears to be at:

    CATEGORY QUERY:
    SELECT wp_term_taxonomy.count as ‘count’,
    wp_terms.term_id, wp_terms.name, wp_terms.slug,
    wp_term_taxonomy.parent, wp_term_taxonomy.description
    FROM wp_terms, wp_term_taxonomy, wp_term_relationships
    WHERE wp_terms.term_id =
    wp_term_taxonomy.term_id = wp_term_relationships.object_id
    AND wp_terms.name != ‘Blogroll’ AND
    wp_term_taxonomy.taxonomy = ‘category’ ” ORDER BY wp_terms.name
    ASC

    CATEGORY QUERY RESULTS
    Array
    (
    )

    However, I saw categories before recent upgrades, and my posts say they are categorized.

    -mitch

  39. Jerome says:

    I’m trying to use Collapsing Categories manually and find that I cannot change the options for it under Settings — I can select the various form items, but when I “Update options”, none of the changes stick except for what is in the Style info box. (I’m using version 0.8.1 under WP 2.7, Widget mode works fine).

    Also, I think your manual installation code is missing a semi-colon and a curly bracket, I beleive it should be:

    <?php
    if (function_exists('collapsCat')) {
      collapsCat('%i%');                     /* added semi-colon */
    } else {
      echo "<ul>\n";
      wp_get_categories(your_options_here);
      echo "</ul>\n";
    }                                        /* added curly bracket */
    ?>
  40. Jerome says:

    Hmmm… not sure what happened to my code up above, but Jessie Angel’s first post on Dec 26 does show the properly corrected code.

  41. Jerome says:

    Update…

    I installed 0.7.1 and that seems to work fine in a manual mode. I would like to try 0.8 too, but that does not appear anymore at wordpress.org. (I did also try the development version, but that worked the same as 0.8.1)

  42. robfelty says:

    @Mitch,

    I just released a few more bug fixes in 0.8.2. (should be on the wordpress site soon). It looks like it might have something to do with excluding or including categories. You might try playing with those options

    @Jerome,
    For nice code, use lang=’php’ (or whatever language you are using). I should put a note about that in the comments.

    That is weird that 0.8 seems to have vanished.

    I fixed the manual settings in 0.8.2

    Rob

  43. Mitch Berger says:

    I just got frustrated playing with include / exclude. I tried each with the field blank, I tried exclude “Uncategorized” and then tried silly things just to see if I can get anything to show.

    Looking at the SQL I posted, I was wondering. Did you really intend to create “WHERE wp_terms.term_id = wp_term_taxonomy.term_id = wp_term_relationships.object_id”, a three-way equals, as the first AND term? I am surprised MySQL even parsed it.

    Awaiting 0.8.2’s arrival as an auto-upgrade….

    -mitch

  44. watson says:

    Rob
    I upgraded to CC 0.8.2 and still no luck. The CC widget shows up in the sidebar, but only the title shows up. No categories or posts show below. I upgraded automatically. Tired to do a manual install of CC but don’t know where to put the code into my sidebar.php file. The older version of CC and WP 2.6 worked great with an auto install. No luck since moving to WP 2.7. Any help is appreciated. Thanks

  45. robfelty says:

    @Mitch,

    does the SQL query return anything from the command line? It works fine for me. I’ve fooled around a bit, and the following query also seems to return the right results for me:

    SELECT wp_term_taxonomy.count AS 'count', wp_terms.term_id, wp_terms.name, wp_terms.slug, wp_term_taxonomy.parent, wp_term_taxonomy.description FROM wp_terms, wp_term_taxonomy, wp_term_relationships WHERE wp_terms.term_id = wp_term_taxonomy.term_id  AND wp_terms.term_id = wp_term_relationships.object_id AND wp_term_taxonomy.term_id = wp_term_relationships.object_id AND wp_terms.name != 'Blogroll' AND wp_term_taxonomy.taxonomy = 'category' AND wp_terms.slug NOT IN ('uncategorized') GROUP BY wp_terms.term_id ORDER BY wp_terms.name ASC;

    @Watson – it is likely that your problem is the same as Mitch’s and that it has something to do with mysql. I think we are making progress.

    Rob

  46. John Bunting says:

    Humn I spoke too soon. 0.8.2 is not working in this blog that I am taking over soon hence odd way of writing it http://sdaresourcesADD-DOT-HEREorg/health/

    John

  47. mheej says:

    i just uploaded the newest version 0.8.2 for collapsing categories and my widget for collapsing categories now is NOT SHOWING.

    I have already deactivated the plugin . reactivated.
    uninstalled and reinstalled and added it again on my widget
    but it’s still NOT SHOWING

    please help

  48. Mitch Berger says:

    John,

    The query the plugin produces doesn’t work on the command line. Your query, where the three way comparison is split into two comparisons ANDed together does return results. I don’t know if this is an error, but the results begin as follows, with duplicates:

    count

    term_id

    name

    slug

    parent

    description

    7
    28
    Absolutism
    absolutism
    3
     

    7
    46
    Ahavah
    ahavah
    5

     

    7
    46
    Ahavah
    ahavah

    5
     

    5
    34
    Amidah

    amidah
    6
     

    7
    24

    Anavah
    anavah
    5
     

    7

    24
    Anavah
    anavah
    5
     

    5
    56
    Anger
    anger
    5
     

    15
    47
    Audio
    audio
    0

     

    15
    47
    Audio
    audio

    0
     

    3
    26
    Aveilus

    aveilus
    5
     

    (No, you’re not going nuts or dyslexic, many of the Categories are transliterated Hebrew.)

    -mitch

  49. John Bunting says:

    Rob

    0.8.2 works beautifully in all blogs where it has not already been installed under previous versions.

    What file/file(s) does or can the plugin write to in current and previous versions? I was wondering if legacy code was left somewhere that was causing problems. Anyway I would be interested to check and compare.

    Thanks

    JohnB

  50. Rob says:

    @John,

    The problem seems to be with the sql query for categories, and other people are having this problem too. I think I have a solution for it, which I will release soon.

    Rob