Releasing the Collapsing Categories Wordpress Plugin
December 19th, 2007I started using the Fancy Categories plugin by Andrew Rader about 6 or 8 months ago. I have been slowly modifying it for some time now, and it seems appropriate to release it as a new plugin. (Note that I thought that Andrew Rader disappeared as well, but I now have found him at his new home at void*. The functionality is best described by simply looking at my categories list on this blog. The default wordpress categories list is a simple unordered list. This plugin gives it some dynamic capabilities, similar to the default on Blogger. I have decided to keep increasing the version number from what Andrew was using, so I am calling this version 0.2. Here are the main highlights:
- Changed name from Fancy Archives to Collapsing Archives
- Changed author from Andrew Rader to Robert Felty
- Added triangles which mark the collapsing and expanding features That is, clicking on the triangle collapses or expands, while clicking on a month or year links to the archives for the said category. This uses html entities (dings) instead of images, for a variety of reasons
- Lists the titles of posts, instead of just listing subcategories
- Removed the rel=’hide’ and rel=’show’ tags, because they are not xhtml 1.0 compliant. Now uses the CSS classes instead
- MOST IMPORTANTLY — it is compatible with both the pre 2.3 database which uses categories, and the 2.3+ database structure which uses the tag taxonomy
You can download it from the Wordpress plugin repository.












Mark wrote:
Hi Rob,
Great Plugins. I have collapsing categories working fine, but collapsing archives is blank. The little arrows are there, but they open up to nothing. Any thoughts and assistance is appreciated.
Mark
robfelty wrote:
Mark,
Several possibilities:
1. If you downloaded it from the official wordpress repository, I just realized that I had accidentally place d the files from collapsing-categories into the collapsing-archives repository. I have fixed that.
2. If you downloaded it from robfelty.com, I had the right files there. It is possible that the combination of options you chose is causing that effect. I think in a future release I am going to make the default options the same ones that I use.
3. Maybe it is something to do with the version of wordpress you are using or the particular theme. What theme and version are you using?
Thanks for your comment, and I hope you enjoy the plugin.
twincascos wrote:
Hi, thanx for posting your hack of the fancy cats. I’m just testing it out, and for me I’ve lost the nested cats. Cat A with sub cat 1,2,3 display as Cats, A,B,C,1,D,2,3. Perhaps that’s intentional. I’ve also noticed an add action in the collapsCat.php to a file fancy-categories.php which isn’t present, maybe I don’t understand properly. Great options for this would be : title of widget, path to arrow images, and number of posts in post post list.
robfelty wrote:
Twincascos:
I did get rid of the nested categories function. I was not personally interested in that myself. In fact, the original fancy categories plugin did not do what I thought it would, after checking out the fancy archives. plugin. I will try to add that functionality back in.
As far as that add action goes, I don’t think it really matters that much, but thanks for noticing. I changed that in the trunk branch of the repository.
Re: options - are you saying you would like the option to use images instead of regular glyphs? Currently the triangles are just regular glyphs from whatever font you are using, and seem a better option to me than images for several reasons. (1) they are scalable. (2) fewer images on the page to load. (3) they will look good with whatever background color you use, and (4) you can style them with CSS.
I will look into adding options for the title and the number of posts.
Thanks for your input.
Alicia wrote:
Hi,
Great plugin, but is there a way so that pages don’t show up in the list (like in collapsing archives)?
Also, in collapsing archives, when I put the option to show comments on posts, I get a php error. It’s n big deal, since I don’t really need to show comments, but thought you should know.
Ross wrote:
Hi there, Great plugin the only one I can find which does what I need but I have the same question as Alicia is there any way so that the pages don’t show up in the drop down list.
Cheers
robfelty wrote:
Alicia,
I fixed the show comments feature in collapsing archives version 0.7.1
Ross (and Alicia),
Interesting feature request. My pages do not show up in my category listing (on this site). What version(s) of wordpress are you using? Could you point me to an example?
Thanks for the feedback.
Rob
Ross wrote:
Hi Rob,
Thanks for the fast reply, if you click on my website link and go to the categories and click the drop down you will see that the contact page and about me page is in the list. The plugin is perfect I just need to figure out how to remove the pages.
Thanks alot
Ross
robfelty wrote:
Version 0.2.2 now has the option to include pages or not (with default being not).
Rob
Ross wrote:
Rob you are an absolute legend it’s working perfect now. This is the only plugin I can find which does exactly what I need thankyou!
Daniel wrote:
hi, its working, but, plugin generate this link:
../2008/02/13/telefonni-seznam
and i need this:
../index.php/2008/02/13/telefonni-seznam
same problem with general categories
generate:
../corporate
and i need:
../index.php/category/corporate/
i have wp 2.3.3
can you help me?
thx
robfelty wrote:
Daniel:
This is an option now in version 0.3.1
Twincascos:
nested categories are back in version 0.3.1
And version 0.3.1 now uses fewer database queries as well. (But it is not compatible with wordpress 2.2 or less — working on that)
Alicia wrote:
Hi Rob,
I think pages where showing up because I had articles in the uncategorized category. Now that I don’t have any articles in it, the pages don’t show…
Daniel wrote:
hi,
solution is:
allow rewrite_module
use
rewriterule-viewer-plugin
http://www.askapache.com/htaccess/rewriterule-viewer-plugin.html
run this plugin
thats all :)
mrhappymac wrote:
hi,
I just installed 0.3.2 and it wasn@t working as expected
I noticed in my page source “” was a not in the right palce I moved it from line
68 echo “\n”; <—— “wrong”
if (!function_exists(’collapsArch’)) {
echo “\n”;
echo “\n”; <—— “right”
now the link is back on the arrow and the collapse function works perfect, Thanks for a great plugin.
mrhappymac wrote:
bunmmer no code! open the file collapsCat.php
look for
$url = get_settings(’siteurl’);
move this line -> echo ” style type=’text/css’ \n”; echo ” style type=’text/css’ \n”; <—— “right place”
robfelty wrote:
Mrhappymac:
Thanks for poking around the code. I fixed this in version 0.3.3. Please upgrade, and thanks for your patience.
Rob
dev mrhappymac » Blog Archive » Again a second cat just for testing wrote:
[...] Deepthoughts by Robert Felty has released an update to his “collapsing Categories” plugin, the update is available for download on the Wordpress site. I like this plugin, very useful. Keep up the good work Robert. [...]
Krysthora wrote:
HI (i’m french, sorry for my english…)
i have problems with blanck screen when i click on the articles in ‘ColappsingCat’
and I can’t read ’specials chars’ with Colappsing archives.
it is possible to ‘repair’ this ? if i can help.
K Stone wrote:
Bravo! Excellent plugin. Is there anyway to make it display the categories alphabetically? Thank you.
robfelty wrote:
Krysthora,
I don’t have much of an idea what your problem could be. Do you have permalinks turned on?
K Stone,
Thanks for the compliment, and a good suggestion. I added an option to sort by category id or name, either ascending or descending, in version 0.3.4.
Rob
Krysthora wrote:
Robfelty,
thks for attention, my permalinks are on “defaults” option
probleme is “specialschars” no correct forms in the archives, and in the categories no link from the articles. i show an example in my site since 24hours^^
robfelty wrote:
Krysthora,
Now I see the issue. Apparently the plugin currently only works when using the ‘date and name based’ permalinks option. The same goes for the collapsing-archives plugin. I will work on making it compatible for other permalink structures, but it might take some time.
Rob
robfelty wrote:
Krysthora,
I think I have fixed this in version 0.7.7 of collapsing-archives and 0.3.5 of collapsing-categories. Thanks for pointing it out and leaving up a semi-broken version of your site for awhile. I would not have been able to figure it out otherwise.
Rob
Krysthora wrote:
Hi,
Thanks you very much !!
It’s a very nice plugin and your attachment for resolve problems : thanks a lot !
u can see result on my blog (just the “specialchars problem” frenchies and the accents^^)
i don’t know how do that but specials chars in CollapsCat are goods …
krys
Krysthora wrote:
Robfelty,
for help (maybe) i use srg clean archives with good screen for specials chars
krys
Krysthora wrote:
Sorry,
I think i ‘ve speak so fast. There’s a “litle probleme” with links’s articles in the ColapsCat open only one article and ever the same.
I hope that will be possible to resolve it.
Krys
Krysthora wrote:
nice vesrion 0.3.6 without any problem
thanks
Ben Hawkins wrote:
Hello, i love your plugin and it works great on my site, the links all work well, but i am having trouble styling the widget in the sidebar. where should i make the edits? in the style.css page? or in collapsArch.php page? i would really like to style it so it looks similar to my other widgets. Thanks and keep up the good work :)
robfelty wrote:
Ben — Glad you like the plugin. That is a very good question. Currently I have some style info set in the header which is in collapsArch.php. So if you use your own stylesheet, it is possible that the styles defined in collapsArch.php could override your styles. However, if you modify collapsArch.php, then if you upgrade to the newest version (I am sure more versions will be coming), you could lose your changes. So I guess I would recommend looking at the styles defined in collapsArch.php, and see if they conflict with what you would like. I should write a little better documentation, and figure out a nice way to allow more custom styling.
I hope that answer helps.
Rob
Marcos wrote:
I’ve got this error at save sidebar widget in WP 2.5:
Cannot redeclare getsubcat() (previously declared in /blog/wp-content/plugins/collapsing-categories/collapsCatList.php:153) in /blog/wp-content/plugins/collapsing-categories/collapsCatList.php on line 153
robfelty wrote:
Marcos,
Thanks for alerting me to that. I didn’t have this problem because I already had it installed. I have fixed the problem in version 0.4.1
Rob
Marcos wrote:
Hi again, I have done a clean installation of WP 2.5. I uploaded the plugin and when I try to activate the Widget, WP produces this error:
Warning: Cannot modify header information - headers already sent by (output started at /homepages/36/d205405875/htdocs/blog2/wp-content/plugins/collapsing-categories/collapsCatList.php:200) in /homepages/36/d205405875/htdocs/blog2/wp-includes/pluggable.php on line 689.
robfelty wrote:
Marcos,
Ahah! Interesting. I didn’t have any problems installing, but when I went to try to validate the xhtml, I saw the problem, and have now fixed it in version 0.4.2. Thanks for being patient.
Rob
trinity777 wrote:
Wow! This a great plug in! There is only one thing that I’m having issues with and then it will be perfect.
I maintain an internal knowledge base for my company using WordPress 2.5. I recently have been asked to figure out how to make this public but at the same time keep some thing privet. I did this by using the PostLevels plugin by Filipe Fortes. This plugin is not officially supported by WordPress 2.5, but it is getting the job done of hiding posts and Categories from viewers who are not logged into WordPress as a user.
When I enabled Collapsing Categories, I thought for a second everything was exactly what I wanted. But I noticed the some posts were appearing that should be private. Now, when I clicked on the name of the post that is supposed to be hidden, PostLevels still denies access to viewing the post but it’s an ugly 404 error because the file is not found. Post Levels does this by adding a custom field called post_level to any post marked privet and uses that as the condition to prevent non-logged in users from seeing privet posts.
Now that I’ve written a novel for you on the back story, is there a way to exclude these posts from the list of posts that Collapsing Categories creates in the side bar? I confess that I’m not a PHP programmer, but my experience with Perl leads me to believe that there must some kind of a condition statement I can add that will accomplish this task. The question is what that would be and where it would go. Any suggestions would be so very much appreciated.
trinity777 wrote:
Disregard…I feel very foolish right about now for not tunning on my security plugins after upgrading. I have some other issue related to Collapsing Categories referancing a diffrent permalink structure than I am using. I saw that posted above in this thread.
Thanks again for such an awsome plugin!!!!!
robfelty wrote:
Trinity,
It seems that I re-introduced that bug with permalinks that I fixed in 0.3.5. I have now fixed it in 0.4.3. Thanks for the comments.
Rob
Alicia wrote:
In one of my sites it duplicates entries, instead of showing them once. If you expand Crochet > Techniques (which says it has 2 entires) actually has 3. You can see it at
http://www.hookandneedles.com/category/
Also, now that I updated to 2.5, the settings page doesn’t load, so if my problem is a setting, I can’t change it.
It’s a great plugin.
robfelty wrote:
Alicia,
Thanks for alerting me to that. I think the problem had to do with nested categories. This should be fixed in version 0.4.4 now.
Rob
p.s. I like your site design
Hikari wrote:
Hello, I’m using your arquive plugin on my blog but it does not support portuga characters. ç á ó in exemple are replaced by strange characters. Could you fix it plz? My blog is http://hikarinet.info
tnx
Trinity777 wrote:
You know how you assume things are working fine, and the you try to show someone who cool things are, and at that moment you realize something is wrong?
So things are working perfectly with my category side bar now…if I am not logged in as a user. If I am logged in, and I have a post marked as privet (I use Post Levels plugin for this), that post displays twice in the list. Isn’t that weird?
Soooo close to perfect, it hurts.
robfelty wrote:
Volvox,
I think this issue should be fixed in version 0.4.4.
Trinity — I think 0.4.4 should also fix the duplicate entry you see.
Rob
Hikari wrote:
Hello. Is there a way to disable posts being shown under collapsed categories? The layout is getting ugly on low resolutions.
robfelty wrote:
Hikari,
I’m confused. The whole point of the plugin is that you can expand and collapse the posts, and they are all collapsed by default. If you don’t want to see them, don’t click on the triangle to expand it. If you want to see the category listing, click on the name of the category.
Maybe I didn’t understand your question.
Rob
Trinity777 wrote:
Rob,
Thanks for the suggestion. Just to make sure, I re downloaded the 0.4.4 release and it is still giving me the same result. But the issue only happens when I log in as a user to the blog (any user). The non-logged in users see thing perfectly, but I’ve found the following stuff happening when I am logged in:
1. If a post is marked privet, it shows up twice in the list when you expand the side bar
2. If there are privet posts in a category, the number displayed is not the number of posts (sometimes greater, sometimes less then, I can’s see a pattern yet)
Wish I could give you access but my company is not ready to make the site public yet, so it is not web accessable.
robfelty wrote:
Volvox,
Can you check your server logs for an error message?
Rob
Hikari wrote:
Hello rob, I’ll try to explain.
Categories are nested as a tree right? Take a look on my 2 blogs http://hikarinet.info and http://ConscienciaPlanetaria.com There are many categories, mainly nested inside Consciência and autores. I want that, by default, all nested categories to be hidden. Then when a category is collapsed, all categories inside it are shown.
The issue is that, together with nested categories, its posts are shown too.
I made an exemple. At http://wptests.hikarinet.info I created 2 parent categories: “Cat with no posts” (with “Cat with no posts 01″ and “Cat with no posts 02″ nested) and “Cat with posts” (with “Cat with posts 01″ and “Cat with posts 02″ nested).
On the right sidebar, I put normal categories widget and Collapsed Categories. Note that “Cat with no posts” and its nested categories are not shown, while “Cat with posts”’s posts are being shown below its nested categories.
What I want is something like Collapsed Archives just below. Year collapses to show months, but months don’t collapse to show posts (I disabled it). I want parent categories to collapse to show its nested categorires, but not showing any post at all.
Sorry for the big post :)
robfelty wrote:
Hikari,
Now I see what you mean. Upgrade to the development version. I have added an option to do what you want.
Rob
Alicia wrote:
Hi Rob,
I upgraded to 0.4.4 and I still get duplicate entries. I think it may be one of my settings (I have the same plugin installed in another blog in the same server, and there it works fine). The problem is that I can’t change my settings. When I go to the settings all I see is “Are you sure you want to do this?”, which is not even a link (same thing for collapsing Archives).
I’m glad you liked my site :)
Alicia wrote:
Me again,
I think I found the problem. I don’t know if it’s my database that’s wonky, or if that’s how it’s supposed to be, but the posts that were duplicated happened to have tags which coincided with the category name.
Once I removed the offending tags, it stopped showing up twice…
robfelty wrote:
Alicia,
Thanks for the tip on that last one. It wasn’t just you. I updated the postquery SQL query, and that fixed the duplicate issue. I also added some options to the widget in 0.5.1.
Thanks for your patience.
Rob
mccormicky wrote:
Hello and thanks first for this plugin I couldn’t do what I wanted to do with categories without it.
Now, for the problem.
In collapsecatlist.php there is this:
(and the closing tag of course), which causes pages to fail validation.The validator says there is a ul tag that isn’t finished, then it points to the line of code I typed above.
But it’s just html, not php or javascript causing errors so the plugin works.
I must have done something wrong because your page doesn’t have the same errors, I checked with an html validator.
Our categories all have subcategories — we used to use another plugin that did kind of the same thing–sort of–and in order to make the categories show up the way we wanted them for that plugin we had to title the posts with the same name as the subcategory…which was a bit redundant to say the least.And probably really bad for seo.
Now I’m wondering if I got rid of the subcategories if that would get rid of some of the errors-if not all.
What do you think?
Otherwise thanks a bunch!
mccormicky wrote:
drat! ul style=”display:none” is what i was talking about.
Lucian wrote:
Hey Rob,
Great plugin. I have loaded them into my site, but the triangles on both the collapsing categories and the collapsing archive don’t work. They are there, but they don’t expand (they are not an active link either). I noticed on the collapsing archives comments that you mentioned the need for a javascript file that should be in the /plugins/collapsCat/ directory, but I can’t find one for either plugin (category or archive). Any ideas?
Lucian
Michael wrote:
I, also, cannot get the plugin to work. I am new to Wordpress and REALLY wanted the functionality Collapsing Categories brings to it. Basically, like Lucian above, clicking on the triangles does nothing. Is there something else besides installing and activating the plugin needed?
robfelty wrote:
Michael,
If you put up a test site with the errors, I might be able to help more. Lucian said that deactivating and then re-activating the plugin worked for him. Also make sure that the plugin is installed in the right place. It should be in:
wp-content/plugins/collapsing-categories
Rob
Jeff wrote:
Hi Rob,
Great plugins!
I’m trying to figure out how to have a collapsible menu version for my normal static ‘pages’ as well as the categories and archives? I have numerous pages and such a function would be excellent. Is there any plugin available that you know of which does this or can any of yours be used, if so can you kindly point me in the right direction as I’m struggling to find something suitable.
Loving these plugins, work superbly.
Jeff
Hikari wrote:
Jeff I think that what you need is an horizontal menu with support to nested submenus.
Take a look on my blog http://ConscienciaPlanetaria.com I use such menu there and on its botton there is the author link.
You should search some with about using WordPress as a CMS too :)
GingerNuts wrote:
Yes, Id like a version of collapsing ‘Pages’ too to complement these plugins.
If this could be done id be happy to donate.
GN
robfelty wrote:
GingerNuts and Jeff. Your wish has been granted. I have a preliminary version of of collapsing-pages. I have requested to host it in the official repository, but haven’t been granted access yet. For now, I put it in my own svn repository. You can find it at:
http://robfelty.com/svn/viewvc.cgi/collapsing-pages/
Please let me know if it does what you were hoping it to. I actually did not realize that you could have sub-pages before you requested this. So thanks for letting me know.
Hikari, what theme are you using on your site? I am interested in using wordpress more like a CMS as well.
Rob
Hikari wrote:
Author link is on my blogs. Are you talking about http://ConscienciaPlanetaria.com ?
Anubis is a nice theme, I contacted author asking for a custom theme with full width but he didn’t answer yet.
About the menu, the blog has link to author too. The theme didn’t have any kind of pages menu, so I added that menu there. It supports at least 5 levels of submenus on it, I never saw a CMS theme with such nice menu :P
Adam wrote:
Hi and thanks for the awesome plugin. I’m having a small issue: I once changed the css to make the arrow smaller and now in FireFox but not IE it has some funky behavior. Once expanded, the arrow shinks and no longer has hover-over behavior. I have complete deleted the plugin files and re-uploaded them but cannot get it fixed. http://somedaymap.com/
Thanks for any tips.
GingerNuts wrote:
Rob,
thanks i will look into it now, hopefully itll be just what im looking for, where shall I forward the donation?:)
GN
robfelty wrote:
GingerNuts: I have added a donation link on my Wordpress Plugins page.
GingerNuts.com wrote:
Looking great so far rob, is there a wayu I can exclude certain pages from being included in the collapsing menu?
thanks
GN
robfelty wrote:
@Gingernuts - I added an option to exclude certain pages (and sub-pages of those pages) in version 0.1.1
@Adam - I took a look at your site, and confirmed the behavior with Firefox. It definitely has something to do with your theme. I took out the css line on the body with font-size 65% or something like that, and that did the trick. Maybe you could also try adding an id tag to the span.collapsArch rule, like #sidebar span.collapsArch
Rob
adan wrote:
Thanks rob, it’s very cool of you to provide free help like this. I remove the line you mention but it does not fix the issue for me. Clearly, I’m not a web developer and have little understanding of CSS, i mostly just hack my way through it when needed. I guess I chose a bad theme because there are many things in there that seem unnecessary, such as this.
in style-core.css i remove the line: font-size: 62.5%; /*Resets 1em to 10px , but there’s font-size’s all over the place compensating for it.*/ but still have the issue (i’ve put it back in now until I have time to fix all the fonts). Thanks again.
GingerNuts wrote:
Hi Rob,
Am having some issues with the plugin, breaking out of the widget style etc, if there are various pages, and subcategories, not sure how to explain it, it isnt display