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”
Great plugin. I experimented with an earlier version of this and it didn’t really work for me. This one is much better. It’s great that you’ve provided the options to exclude certain categories.
One minor bug: when the mouse arrow hovers over the “expand” / “contract” character, rather than turn into a finger (to indicate that something might happen if you click on it) it turns into a simple vertical line (as if you are expected to type or select text). Readers therefore are unlikely to click on the “expand” / “contract” character.
Strange: it seems to work fine in your sidebar on this site, but on my test site (http://test.londonkoreanlinks.net/) the mouseover doesn’t work as it should. Any ideas?
Hi, I just installed your plugin and it seems to be working great- thanks. One question though…. Is there a way to change the color of the collasping bullets. The black color is just too dark for my site.
Thanks again!
@Philip,
Check out this page on your site:
http://test.londonkoreanlinks.net/wp-content/plugins/collapsing-categories/collapsCat.css
It should be the same as:
http://test.robfelty/wp-content/plugins/collapsing-categories/collapsCat.css
I think this probably a problem with your mod-rewrite settings. If you don’t want to change those, you can copy the style info in the the collapsCat.css file to your themes stylesheet, and that should do the trick.
@Cindy,
The color of the bullets should be inherited by whatever color you have chosen for plain text, which seems to be black, looking at the content on your site. You should be able to add a rule this in your theme’s style.css file
#sidebar .collapsCat {color:#878773}
I hope that helps.
Rob
Thanks Rob
I couldn’t access the css file on your site…
But I’ve done the following:
– I verified that the css file in my plugin directory is the same as the one in the latest version of the widget downloaded from WordPress. That was fine.
– I pasted the css into my main stylesheet. That helped. Cursor behaviour improved – managed to get a pointer (I even played with the cursor attribute to get a crosshair – which is the version that’s on my test site at the moment). But this behaviour only seems to work in Internet Explorer (which I don’t use), not Seamonkey (my default browser), Flock, Opera or Firefox.
So close! But I’m reluctant to install something which only seems to work with IE. I don’t think my mod-rewrite settings are anything other than standard, but they may be. Also, maybe there’s stuff in my main css file which conflicts with your css, but I can’t see anything obvious.
Anyway, thanks for looking.
Philip
@Philip,
Whoops. I gave you the wrong url –
http://robfelty/test/wp-content/plugins/collapsing-categories/collapsCat.css
I think I may have found your problems – your html doesn’t validate, and neither does your css. There are only a few problems with the html — check it out here:
http://validator.w3.org/check?uri=http%3A%2F%2Ftest.londonkoreanlinks.net%2F&charset=%28detect+automatically%29&doctype=Inline&group=0
you have some html style comment delimiters in the css file (<– comment –>) instead of (/* comment */). It happens to be right before the span.collapsCat definition, so I think that may be the problem.
http://jigsaw.w3.org/css-validator/validator?uri=http%3A%2F%2Ftest.londonkoreanlinks.net%2Fwp-content%2Fthemes%2FLKL_Version_3%2Fstyle.css&profile=css21&usermedium=all&warning=1&lang=en
Interesting that it works in IE. I use Firefox mostly (but try to test stuff in IE as well). Have you tried out the Firebug plugin for Firefox? It is a great tool.
Let me know if this helps.
Rob
Thanks – I’ll take another look soon.
Annoying – I had already fixed the css error in my live site last time I did a validation check. I just hadn’t got around to keeping my test site in synch :-(
Cheers
Philip
OK, me again.
My html and css is fine now. IE is fine.
Other browsers seem to be fine initially, but once you expand the category, the cursor reverts to its old behaviour, for that category. And for some reason the little arrow-heads shrink once you’ve expanded them…
Philip,
I checked your version, and you are on 0.5.6. I was about to quickly reply to upgrade, then I realized that I hadn’t actually committed 0.5.7 yet. It is now committed, and I am 90% sure that this should fix the remaining problems.
Thanks for your patience,
Rob
One problem here (first let me not forget to congrat you on your widget, seems to be the only of several Coll-Cats that works for me at all):
On my site and with Firefox/Mac on mouseover it seems to ignore my Cat Descriptions, replacing them with the standard “View all posts filed under cat” for non-existant descriprions.
WP 2.5.1, plugin 0.5.6
I have double checked my args for descriptions, they are definitely not empty, and also checked your files, at first glance your code suggests it would transport and ack the descriptions… – but it doesnt…
Check out: http://mallorca-service.net/node/ , as its a test site atm I gladly give you the necessary information to investigate at some depth, contact me via site.
Keep up the great work!
Kind regards,
Matt
Just installed version 0.5.8, the problem with the Categories Descriptions not displaying is solved.
Thanks, GJ!
Kind regards,
Matt
Hi,
One annoying thing I’ve noticed about this plug-in and others like it is that the expanded selection collapses after the page is updated with the selected item. Is this something that was done purposefully in the design or a side-effect of the design.
-john
Thanks Robert. I’m just getting started trying your plugin and believe it will be the perfect feature for me to add to a new web site. I’d like to display empty categories as I build the site. If you can recommend a way to do this, I’d appreciate it.
-Tim
@Matt – Thanks for finding that bug, and I am glad the problem is fixed
@John – That is the intended behavior. The expanding happens with javascript. It would be possible to set cookies with javascript, and then read them back. I will think about this in the future.
@Tim – If you only want to do this temporarily, you can remove the following from collapsCatList.php
Line 246 – change:
if ($theCount > 0) {
to
if ($theCount >= 0) {
Thank you very much. I got it to work. I’ll touch base again once I have the site up.
I’ve been looking for a plugin like this for quite some time now. I am currently using your collapsing categories and archive plugins. Concerning your Collapsing Categories plugin for wordpress, would it be possible to automatically expand specific categories. Perhaps by typing in the category name into a box like your exclude category option.
Hi!
(I think I) found another bug:
I followed your hint to show empty cats (much better for my purposes that people see where there is nothing to slook for), but now the Top cats show the double count of what is actually present.
You can check that out at my test website (http://mallorca-service.net), right the first cat shows this behaviour (Animals). It shows a (false) post count of 2, the subcat (Veterinaries) shows (correctly) a post count of 1. If you click on the Animals cat you can see there is only one post present that is categorized both in “Animals” and “Vets”.
Even worse this behaviour is in the “Food and Drink” category, there we have 5 posts that sum up to a (false) top cat post count of 22 somehow.
Any ideas?
Kind regards,
Matt
@Matt,
Well, this could be considered a bug, or it could be considered the correct functionality. What is happening in that you have some posts that are categorized as more than one category, and some of these categories are subcategories of each other. For example, you have post 1 categorized as A,X, and Y, and your category structure looks like:
A
X
–Y
–Z
B
C
Post 1 gets counted twice, because it is tagged as both X, and Y. I am not sure there is a workaround to this, other than only categorizing posts as either X or Y. If you choose Y, it will automatically be included in the listing for category X; if you choose X, it will not be included in the listing for Y. I think this is really how subcategories should work.
Rob
Hi Rob
Just to say, I’m now playing with v0.5.8, and it seems to be working fine. Time to take it across to my live site, I think.
Requests for functionality in future upgrades?
– fully customisable category order
– ability to insert spacers and / or subheadings in the category list
No harm in asking!
Thanks for the great work.
Philip
Spoke too soon. It’s working absolutely fine on my live site, except that it doesn’t seem to want to exclude the parent categories I tell it to exclude. Not a big deal. Is it just something buggy on my site, or is it a bug in v0.5.8?
Thanks
Philip
@Philip,
Thanks for the suggestions.
As far as order goes, there is a field in the database called “term order”, which does not seem to be used yet. As soon as wordpress actually starts using this, my plugin should be able to take advantage of it, but until then, I don’t feel like I can do much.
What do you have in mind as far as subheadings or spacers? Could you provide an example?
As far as category exclusion, are you inputting the names of the categories, or the numbers? The default wordpress function uses category number, which seems very cumbersome to me, so I use category name. I actually convert it to a slug, so if you have a category called “foo Bar”, I convert it to “foo-bar”, meaning that any of “foo bar”, “Foo Bar”, “Foo-BaR”, etc. should work.
Re subheadings, I guess it’s a way of organising my categories without changing the permalink structure. So, I’ve got long established categories such as “film” “book reviews” “Art reviews” which I’d like to group together in the sidebar under a heading such as “Culture Zone”; categories such as “style” and “travel” which I’d like to group together under a heading such as “Living”. It’s like pulling together the different segments of a newspaper into pull-out sections I guess. When I started with my obvious categories, I didn’t realise that some day I’d want to group them, and now I don’t want to play with them too much in the database – I’m looking for a “topside” way of achieving it. Hence also the request for customisable order – because sorting alphabetically or by slug or by ID won’t do it for me. I would need a “user-sort-id” field so that (eg) “film”, “book reviews” and “art reviews” are IDs 1,2,3.
But maybe a quick way round would be to have the ability to have several collapsing category widgets in the same sidebar. Widget 1 I could call “culture zone” and only include the categories I wanted in that group; Widget 2 I could call “Living” and only include “style” and “travel”, and so on. Within each widget the category order wouldn’t matter too much. All that’s probably easier to achieve than the way I expressed it the first time round.
Category exclusion – I was using IDs. I’ve now tried slugs, and it’s working fine. Thanks very much
Philip
I use your collapsing categories at a site that I’m putting together for a Master’s project and it works great!!! I’m really new to the whole WordPress thing and I’ve run into one issue. When I activated your plugin, I was hoping it would replace the existing categories section included with the theme I’m using. Instead, I have the category section, then blogroll, and then the collapsing categories. Is there any way I can get rid of the category section that came with the theme and replace it with the collapsing version? The site is at http://www.tech4teachers.info. Any help would be greatly appreciated.
Plz add one more sort order “ORDER BY $wpdb->terms.term_order” for compatibility with my-category-order plugin.
I just installed the latest version of your hack on my website and cannot get the post links to show up. Javascript is enabled. If you have any ideas, give me a message.
I’m using the collapsing categories plugin at my site and it works great. The problem that I’m having is that now I have a regular categories section (non-collapsing) and a collapsing category section. I only want the collapsing category section. Do you know how this can be done? To see what I mean, please check out http://www.tech4teachers.info. Thanks
hi there! i just wanted to say that this is a fantastic plug-in, i’ve tried quite a few different ones and this one is by far the most successful and the prettiest and most user-friendly.
i just have two simple questions (i think they’re simple!) and i’m hoping you can help. i have show post count activated. on the top level categories there is no space between the category name and the post count it shows:
uncategorized(1)
rather than what i would like:
uncategorized (1)
on the child categories the spacing is perfect. could anyone point me to which file and where exactly in the CSS i would add that space (i’m pretty much a beginner but i can read the code).
secondly, is there a way to not have categories with 0 posts show up?
thank you SO much!!!!
fantastic plug in – definitely the best one i have found to fulfill this purpose! thank you.
i just have one question. there is no space between the category and post count at the top level of the category heirarchy (all other levels have the space). can you point me to what file and where in the css code i would add in that space? thank you!
Hey,
Just wanted to say what an awesome plugin. It seems to fit in quite nicely with the dbx boxes I have on my site.
Just a quick question… Do you have any plans to make a collapsing links plugin?
I have found another plugin which does this called enhanced links but prefer the style of your plugins and as such would like to keep all collapsing widgets looking and working the same. I would really love it if there was one plugin which took care of all widgets (i.e. links, pages, categories and archives) Is this possible?
Sorry for the lack of responses lately. I have been busy with other projects, including an update to the postie wordpress plugin. I have fixed a few bugs and made some more options in 0.5.9
@Ami – I fixed this display bug. Thanks for poiting it out
@Leo – I will think about doing that. That is how the collapsing pages plugin got started. I can start an empire of collapsing plugins!! (Hopefully that won’t mean my empire will collapse)
@Yube – I added an option to sort by term_order.
Thanks for your feedback everyone, and I hope you enjoy the plugin.
Ditto what Leo wrote about collapsing links plugin. I want mine to look the same as the categories and archives. I haven’t added one yet for pages, but plan to. I would also like to replace the default link topic with an image instead. One image for each category. Image size should be able to vary and not be a fixed size.
I would also like a special plug-in that is database-driven like Mister Linky, but can be hosted on my own server.
Example of how it would work: Basically, if I start a post about a specific type of poem, and I want others to join in on the project, they would scroll to the bottom of my post and enter their link to their post for that particular project. My post then becomes the “host” for others to add their links to. Now we have a auto-link blogroll on the post for all the poets to follow.
Then, I want to create a post for say…a photography theme, such as critters. Again, I can place the autolink widget in my post html code, give it a title theme so the database will know this is a different project from the poem one. It will keep a separate list of blogroll for this project.
Unlimited projects, but the ability to close out a project so new people to the post will see that the project is closed an no more links can be added.
If others have the same need, perhaps we can make a collection of development funding if you’ll make the plugin.
Hi,
I downloaded Collapsing Cats ffrom the WP repository 2 days ago to try it out on a WP 2.6.0 de (German). I found it rather useful but I’m not sure if there’s bug or an installation failure:
On the dashboard under ‘Einstellungen’ (settings) I find a sub-point ‘collapsing categories’. Clicking on this results in a blank screen below the tabs with the question ‘Bist du sicher, dass du das tun möchtest?’ (are you sure you want to do this?’) and nothing else: no option to react. No button osre anything else.
My question: Is this intentionally or is there a bug in the installation for instance?
TIA for your response!
Hans.
Rob,
To echo others this plugin is awesome. I do have a couple of feature requests. I’m setting up a site that is using WordPress as a CMS and as such has a number of page templates. Each page template will have it’s own sidebar and so I would like to be able to have multiple instances of this widget. This then leads to the next request which is to have an option to title the widget instance so instead of Categories I could have My Text show for the heading. Thanks and keep up the good work.
@Sharkgirl – I just released the Collapsing Links plugin yesterday. It does not have support for Mr. Linky like behavior yet. I will have to look into that. It does allow multiple instances of the widget though.
@Jon – You should already be able to set the title of the widget in the widget options. A version allowing multiple instances should be coming out soon.
Thanks for your feedback.
Rob
I have the same issue as Hans. Initially, I was able to set the options. Now, I just get the blank page with the question, “Are you sure you want to do this?”
I have been using the plugin for quite a while with no problem – until I upgraded this morning. For me, it doesnt work at all, its activated, the widget is listed in the theme, but no matter what I do, it wont display. I’m using wp 2.3.3. My ISP (startlogic) decides when I upgrade, so I’m stuck with 2.3.3 for now. Hopefully I saved an older version somewhere.
Update – I went to the WP site and installed older version 0.5.10. Works perfectly again
I have the same prob as Hans after upgrading (luckily only one blog): Accessing settings results in a blank white screen below the tabs with the link “Are you sure you want to do this?” and nothing else: no option to react. No button or anything else.
No problems with the functionality, just cannot get any options/settings to show (e.g. not change markers).
As atm everything works fine I of cause did not hit the “AYSYWTDT” link and will wait to the next version that allows accessing settings again (or downgrade).
Kind regards,
Matt
I’ve been a happy user of this for a number of months now. Great plugin. And I’ve been merrily clicking my automatic upgrade button on my plugins page on my live site without problems. But on reading the above two comments I decided to proceed more cautiously this time (particularly as I can’t get your new collapsing links plugin to work.) I upgraded on my test site (http://test.londonkoreanlinks.net/) and sure enough it stopped working:
(1) The widget unilaterally removed itself from the sidebar
(2) When I put it back in the sidebar in the widgets page, when I click on “edit” to configure it, it immediately removes itself again.
I’ll move back to 0.5.10 as that works just perfectly. Fyi, I’m on WP 2.6 (not 2.6.1).
Thanks for all your efforts
Philip
@Scott and @Philip – Thanks for the feedback. I have confirmed that this updated only works on 2.6+. I have gotten it to work fine on fresh installs of 2.6 and 2.6.1. So it should be working for you Philip. My suggestion is to disable the plugin, then re-enable it, and see if that does the trick.
0.6 is a major update. I thought about calling it 0.6alpha, because I was a bit worried there might be some big bugs. But I didn’t.
Thanks to both of you for your courage in trying out new things!
@Scott – I’m sorry you can’t upgrade wordpress yourself. You are definitely missing out on some nice features. I don’t know what your hosting contract is like, but I like Dreamhost.
Rob
Ouch, the new version has some serious issues. I can’t use the plugin with the “tabbed widget” plugin. I guess because of the “not working as non-widget” stuff. It works as soon as I put the categories into an additional widget… Would be fine if you could fix this..
Thanks for getting back to me Rob. Deactivating then reactivating got it working.
One minor bug seems to be affecting me: no matter how hard I try to tell it not to show the post count, every time I click “save changes” that box magically checks itself again!
I like the option of clicking on the parent category either expanding the list or going to the category archive. Good thought.
Cheers
Philip
@Andy,
I had not heard of tabbed widgets. I tried installing that on a fresh 2.6.1, and I could not get the tabbed-widgets to work with any other widgets. I had no problems using the tabbed widgets using WP 2.6 with version 0.6 of collapsing categories. I will give you the same advice as Philip. Try deactivating and re-activating the plugin. Don’t ask me why this works, but it often does.
@Philip,
Glad to hear it is working for you. And thanks for pointing out that bug. I fixed it in the development version. I will wait a few more days to release 0.6.1
Rob
Here’s another interesting quirk: for some reason there seems to be a change in how the css works in v0.6.0. Suddenly the styling looks suspiciously like the styling on *your* site, Rob, rather than being “inherited” from the styling on mine.
Here it is, at the bottom of the left sidebar:
http://test.londonkoreanlinks.net/
Philip
@Philip,
I looked at your test site, and it looked like you had 0.5.10 installed, so I couldn’t see what you were talking about. I did not change the css, but I did change the html. If you use the option to have category names activate the expanding, then you will see the whole thing in a fixed-width font. I did this because otherwise the +/- signs are slightly different width in most fonts, and I found it to be annoying. If you don’t like it, you can remove that line from the CSS file.
Rob
Rob,
I read your email response to Philips post (which doesnt appear here), he is talking “FONT”, not +/- signs.
Up to now the font used was inherited by the used theme, now (in his case, and I have heard someone else reporting the same to me in private) its your (This one here!) pages font and size.
Check his page aagain and you will see the cats look familiar… ;-)
Kind regards,
matt
Hmmm. Well, according to my plugins page it’s 0.6 ^^.
And yes, I see what you mead. When “Clicking on category name” is set to “Links to category archive” everything looks fine. When it’s set to “Expands to show sub-categories and / or posts” the styling changes to a completely different font. And, in the latter case, you have to have “Expanding shows” set to “Subcategories and posts”, otherwise clicking on the sidebar will never take you to any content.
But actually, my preference is to have “Clicking on category name” set to “Links to category archive”, so I’ll be alright I think.
Best wishes
Philip
@Matt and Philip – Here is the deal:
Here is the default code:
[+] a collapsed category
[-] an expanded category
which is rendered as:
[+] a collapsed category
[-] an expanded category
Clicking on the span (+/-) triggers some javascript
On the other hand, if you choose the option to have the category name trigger the javascript, then I write the following code
[+] a collapsed category
[-] an expanded category
In the former case, the css styling applies just to the +/- signs, not to the category name. In the latter, it applies to both. The reason I chose the fixed width font in the former case is because otherwise the + and – signs have slightly different widths, which means that the category label jumps around a bit, which I don’t like.
If either of you have a better suggestion, I am all ears. I am not very satisfied with the current state of affairs either.
And by the way, if you don’t like the default style of my blog, you can actually change it via the options in the top of the sidebar.
I see.
I suspect you have a reason (probably CSS formatting) for using characters to advise that the category is expanddable, but personally I dont like the approach too much, as they appear differently in different browsers (though I dont feel its a show stopper at all).
In my case (I use the triangles), e.g. in Firefox the unexpanded triangle appears just 4 pixel high, whereas when looking at my page in IE it appears to be about 10 px high.
Maybe thinking about substituting (optionally?) characters for imgages could standardize the appearance?
Just thinking aloud, I can live with how it is currently.
Matt
Scott–I’m using 2.6.1 on startlogic. Contact me for details–http://starferdinand.com/WordPress/contact-form/.
Rob–Do you have a solution to the “Are you sure you want to do this” issue reported by Hans, Matt, and me?
Also, how do the pages sort? I assumed they would be in chronological order by publication date, like the posts, but that’s not how they’re showing up. I can’t tell how they’re sorted.
Scott–I’m using 2.6.1 on startlogic. Contact me for details. http://starferdinand.com/WordPress/contact-form/
Rob–Do you have a solution for the “Are you sure you want to do this” issue reported by Hans, Matt, and me?
Also, how do the pages sort? I assumed they would sort in chronological order by publication date, like the posts, but that’s not the case. I can’t tell how they’re sorted. http://starferdinand.com/WordPress. Expand Roy Osborne/Acts. The pages are Acts; Acts, part 1; Acts, part 2, etc. If they sort by pub date, they should be in numerical order, which they are not. So, how can I control their order?