Lonewolf Online

The website of an amateur photographer, astronomer and petrolhead.

Folding Category Widget

A Wordpress widget to create a Folding Category List on your blog.

As your blog gets more and more posts, inevitably you will create more categories to cope. Eventually your categories will take up more room on your screen, and scroll across many pages. I have a blog which has around 300 categories, and with this number the standard Wordpress category list expands the page and pushes the content below navigation to three or four pages down.

In order to solve this problem, categories can be made ‘children’ of ‘parent’ categories, and a tree like structure is created similar to the folder view in Windows Explorer.

Tip: To create a child category in Wordpress, either create a new category or edit and existing one, and change the "category parent" to the category that is to be the parent. Your category will now be shown indented from the parent.

This plug-in provides a Folding Category Widget for Wordpress versions 2.3.x

 

One of the main features of this Wordpress plugin that has been requested on one site I was working on is that a prioritised list should dictate which category is expanded when viewing single posts. This replaces the behaviour of Wordpress where the category with the lowest numerical id is expanded.

For example, a post is part of a Computers category as well as Latest News and Technology categories. Because the Latest News has a lower ID (assigned by Wordpress when the category was created), when a user visits the single post page, the standard plugin, and the unconfigured plugin, will expand/highlight the Latest News category. By using a prioritised list you can tell the plugin to highlight and expand the Technology or Computers categories instead.

To setup a prioritised list, simply enter a comma separated list of category ID’s in the order you wish to expand. If the post is not a member of the first category in the list it will check the second and third etc… If none is found it will expand the first category of the post with the lowest ID.

 

Main Features:

  • Few SQL queries so it does not put strain on server (except when post count is enabled)
  • Option to cache navigation structure to further reduce server load
  • Very fast (typically < 0.025 seconds) to generate category tree, even with many categories
  • Priority based category selection where multiple categories are available (e.g. single post assigned to multiple categories)
  • Full configuration via Widget Control Panel
  • Wordpress 2.3+ support

 

What’s New in 0.6.1 ?

  • Modified admin panel to better fit screen with Wordpress 2.5 interface.
  • Ability to show empty categories.
  • Revised post count method so its better on memory usage
  • Solved the unserialise bug

 

There is a known issue with the Recent Posts widget when it is placed above the folding category widget. This is an issue with recent posts modifying the current post variable, meaning that Wordpress calls the folding category widget with bad data. For more information please see Problem with Recent Posts widget on the Wordpress site.

Demo sites

 

This script is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

If you develop a plug-in based on this code I would appreciate some credit and a link back to this page if appropriate please.

Pages: 1 2 3

 

Share/Save/Bookmark

 

What Others Are Saying

Joe Posted on Wednesday 1st October 2008 at 10:49am Comment

thx mate you make my life easier!

Heinrich Posted on Monday 22nd September 2008 at 7:20pm Comment

Hi,

I had exactly the same problem as F98 and his solution worked great. Looking forward to the update to fix this bug because i love the plugin!

F98 Posted on Friday 19th September 2008 at 10:42am Comment

Hi Lonewolf,

your hint was helpful to find the problem. First I had to deactivate “Automatically rebuild cache” and then click on “Build Cache”.

When I now write some articles no warning occues, but when I reactivate “Automatically rebuild cache” it shows the warning again when I save/edit an article. I think it seems to be a problem with the cache-rebuilding functionality. I’m using Apache 2.2.6 and PHP 5.2.4.

Regards F98.

Gravatars Lonewolf Posted on Thursday 18th September 2008 at 8:41pm Author

At what stage are you receiving this message? Have you tried clicking on the build cache button which will force a refresh of the data. It sounds like one of the cache objects has either been corrupted or is sticking to a very old version.

Please try and rebuild the cache and let me know.

F98 Posted on Thursday 18th September 2008 at 11:20am Comment

Hi Lonewolf!

The unserialize bug is still online! I use WP 2.6.2 and updated to Folding Category List 0.6.1

Now the following warning messages are occure:

Warning: unserialize() expects parameter 1 to be string, array given in .\wp-content\plugins\folding-category-widget\wp23_folding_cats.php on line 653

Warning: unserialize() expects parameter 1 to be string, array given in .\wp-content\plugins\folding-category-widget\wp23_folding_cats.php on line 653

Warning: Cannot modify header information - headers already sent by (output started at .\wp-content\plugins\folding-category-widget\wp23_folding_cats.php:653) in .\wp-includes\pluggable.php on line 770

Regards F98.

Gravatars Lonewolf Posted on Tuesday 16th September 2008 at 8:12pm Author

I believe that the unserialise bug is now fixed in the latest version (0.6.1). Let me know if there are any more problems.

Tal Posted on Sunday 14th September 2008 at 12:49am Comment

I’m also having the same problem as MadDog

Warning: unserialize() expects parameter 1 to be string, array given in /home/MYNAME/public_html/wp-content/plugins/wp23_folding_cats.php on line 640

Warning: unserialize() expects parameter 1 to be string, array given in /home/MYNAME/public_html/wp-content/plugins/wp23_folding_cats.php on line 640

Warning: Cannot modify header information - headers already sent by (output started at /home/MYNAME/public_html/wp-content/plugins/wp23_folding_cats.php:640) in /home/MYNAME/public_html/wp-includes/pluggable.php on line 770

F98 Posted on Thursday 4th September 2008 at 8:00am Comment

Hi,

I’ve got the same problem like MadDog, but the problem appears with Wordpress 2.6.1 too. :(

Greetings,

F98

Daniez Posted on Friday 22nd August 2008 at 4:38pm Comment

thanx for the plugin, and also the CSS tips…

Gravatars Lonewolf Posted on Tuesday 19th August 2008 at 7:20pm Author

Jon,

There is no JavaScript in this plug-in. It is something I thought about but never implemented.

Each time a link is clicked the page is posted back to the server.

Jon Posted on Monday 18th August 2008 at 8:00pm Comment

This doesn’t seem to work as expected. I thought it would use javascript to expand and collapse to show sub categories of a parent category. It does not seem to do that at all. Do you know of a widget that has this functionality? Something like what Collapsible Archive Widget does but for categories?

Mad Dog Posted on Saturday 16th August 2008 at 8:11pm Comment

It’s a miracle! The problem seems to have been fixed with WP update 2.6.1

Mad Dog Posted on Tuesday 5th August 2008 at 1:01am Comment

Everything&squot;s been great but all of a sudden when I try to add a post I get the following error:

Warning: unserialize() expects parameter 1 to be string, array given in
/home2/abletwol/public_html/able2laff/wp-content/plugins/wp23_folding_cats.php
on line 640

Warning: unserialize() expects parameter 1 to be string, array given in
/home2/abletwol/public_html/able2laff/wp-content/plugins/wp23_folding_cats.php
on line 640

Warning: Cannot modify header information - headers already sent by (output
started at
/home2/abletwol/public_html/able2laff/wp-content/plugins/wp23_folding_cats.php:640)
in /home2/abletwol/public_html/able2laff/wp-includes/pluggable.php on line
770

The post is added, but….what happened? And what do I do about it?

THANKS

QueenEve Posted on Saturday 2nd August 2008 at 11:01am Comment

no updates for wp 2.6 ????
thx

Philix Posted on Friday 25th July 2008 at 4:57am Comment

This is a great plugin!

F98 Posted on Thursday 17th July 2008 at 7:03pm Comment

Hi, with Wordpress 2.6 the plugin produces the following warning after editing a post:

Warning: unserialize() expects parameter 1 to be string, array given in .wp-contentpluginsfolding-category-widgetwp23_folding_cats.php on line 640

Regards, F98.

Gravatars Lonewolf Posted on Tuesday 15th July 2008 at 8:03pm Author

Jeroen,

I do not believe that it is possible to call any of the functions outside of Wordpress because they require Wordpress to be loaded.

Jeroen Posted on Tuesday 15th July 2008 at 4:30am Comment

Hi,

first of all thanx for this great plugin. We are using it at http://amsterdam.spottedbylocals.com

I&squot;ve only 1 question; is it possible to start the &squot;rebuild cache&squot; function outside of WP?

Thanks in advance

Nick Ogbourne Posted on Wednesday 2nd July 2008 at 2:00am Comment

Brilliant. Just can’t get the categeroy exclude to work. What is the categroy id? The name?

John Posted on Wednesday 25th June 2008 at 5:05pm Comment

When i add the widget it makes everything that was previously there disappear in the sidebar, so pages, archives, meta etc dont show, only the categories because of the widget.

Am i doing something wrong?

inspirasi bisnis Posted on Sunday 8th June 2008 at 5:36am Comment

can I see the screenshot before I Install?

Thanks

minde66 Posted on Monday 26th May 2008 at 2:35am Comment

Is it possible to sort categories in custom order as in &quot;Category Order&quot; plugin?

Beren Posted on Friday 16th May 2008 at 5:40am Comment

This is exactly what I needed, thanks so much. Now I have a question… you can produce multiple folding menu&squot;s, but is there a way to not make it global but that you can choose which folding menu goes on which category template. Each category should have it&squot;s specific folding menu and not show the rest…

Elke Posted on Wednesday 14th May 2008 at 10:39am Comment

It’d be so awesome if post titles could be listed under each category in the place of child categories.

Elke Posted on Wednesday 14th May 2008 at 10:37am Comment

Is there any way to alter the link output to generate post titles rather than the entire post?

Thanks!

Trace Posted on Sunday 11th May 2008 at 12:02am Comment

Great plugin! Any hints on where I would look to make it so that even empty categories show?

baron Posted on Wednesday 7th May 2008 at 6:41pm Comment

hi there .thanks for plugin:

Does anybody know if tis script is compatible with Wordpress 2.5.1 ?

Thanks in advance for any help on this!

best regards

etnakorg Posted on Wednesday 7th May 2008 at 5:40pm Comment

many thanks sir, great code.
just a question, I got this:
*icon* ParentCategoryName
(Post count)
*icon* ChildrenCategoryNAme
(Post count)
*icon* ChildrenCategoryNAme
(Post count)

and so on… How to get, where to put the code to get the posts count beside the cat/subcat name, with this layout:
*icon1*ParentCat_Name(Post count)
*icon2* Child_Cat_NAme(pc)
*icon3* Child_Cat_NAme(pc)
*icon4* Child_Cat_NAme(pc)
and so on, is it also possible somehow to set a single icon for each item?
many thanks in advance Etnakorg

rae Posted on Sunday 4th May 2008 at 2:18am Comment

As previous commenter, in WP 2.5.1 I select &squot;show child categories only&squot; and expect sub-cats to be displayed when a main category is opened. This does not happen, nothing is displayed in this setting. Please help. Thank-you.

Richard Posted on Sunday 27th April 2008 at 3:11pm Comment

using wp-2.51 when using the option &squot;show child categories only&squot; this does not display children of a parent category. Any advise please? TIA

malcolm coles Posted on Thursday 24th April 2008 at 2:43pm Comment

Hi, I&squot;m trying to get this to work, but I can&squot;t get the child categories to appear, let alone style them. I have &squot;highlight all categories post is in&squot; set to yes, and &squot;enable css to show expandable categories&squot; set to yes. Is there something else I should be doing? Thanks!

Malcolm Coles Posted on Monday 21st April 2008 at 6:05pm Comment

This looks like just the plug-in I want as I want just the child categories of the parent category I&squot;m in to show, if you see what I mean. That is how the paranormal site above is working. But I can&squot;t get the child categories to show - which option is it that does this. Apologies if I&squot;m being stupid! Or maybe do I need to do something to my CSS as well?
Thanks.

anna Posted on Saturday 19th April 2008 at 1:10pm Comment

Hi! I&squot;m having the same problem as Shannon with &quot;call to undefined function: buildparental()…&quot;. WP 2.5 and a freshly downloaded plugin. =(

FendyBt2 Posted on Thursday 10th April 2008 at 1:18pm Comment

How do I put this plugins in my sidebar with a themes that don&squot;t use widgets? any code to trigger that? thanks… :)

rpoulin Posted on Monday 7th April 2008 at 9:38pm Comment

Great, but I&squot;m not that familiar with CSS. Here a have my Style.css with the following style regarding the sidebar :

#aside {float:right; overflow:hidden; width:230px; padding:10px;}

#aside .title {margin:0; font-size:100%; font-weight:bold;}
#aside .aside-padding {padding:0 10px 15px 0;}

————–
and here is the sidebar.php section concerning the categories:

Categories

——————————
Where should i add the style for the folding category such as your exemple:

#folding_category_list li ul li {list-style-type:none;padding:3px 2px;}
#folding_category_list .lwfcl_level-0,
#folding_category_list .lwfcl_level-1,
#folding_category_list .lwfcl_level-2 {background-repeat: no-repeat; background-attachment: scroll; background-position:top left; padding-left: 15px; background-image: url(images/bullet.gif) }

Thank you.

jan Posted on Thursday 3rd April 2008 at 6:35am Comment

here ist the multilanguage-plugin i try to work with: http://www.qianqin.de/qtranslate/

Jerry Posted on Wednesday 2nd April 2008 at 8:45pm Comment

can you nix that last request. I embarrassingly was using the wrong plug-in … doh. Thanks - great plugin!

Jerry Posted on Wednesday 2nd April 2008 at 8:35pm Comment

The category for the post being viewed isn&squot;t highlighting. Miscellaneous category names are highlighted however. Is this a bug that you&squot;re aware of or user error :) ?

Gravatars Lonewolf Posted on Wednesday 2nd April 2008 at 3:22pm Author

Jan, I’m not familiar with that plugin, could you please direct me to its homepage so I can investigate.

Thanks

jan Posted on Wednesday 2nd April 2008 at 9:02am Comment

hi, a wonderfull plugin!
But i think it doesn’t work with multi-language-plugins like “qtranslate” or “polyglot”.

The category list shows the titles and translations at the same time like this:
“[lang_en]Projects[/lang_en]“[lang_de]Projekte[/lang_de]“… any hints?

thanks! jan

Stojtscho Posted on Wednesday 2nd April 2008 at 8:49am Comment

Sorry for my English (I am from BG):
Where to put the code from the CSS Examples? Thanks in advnce!

Shannon Posted on Monday 31st March 2008 at 12:23am Comment

Thanks so much for the quick fix!

Gravatars Lonewolf Posted on Sunday 30th March 2008 at 12:11pm Author

Shannon, This problem has been resolved. Since you didn’t provide any contact details I can’t email you the fix, but you can re-download the plugin to solve the problem.

Shannon Posted on Sunday 30th March 2008 at 10:35am Comment

I love this plugin and it was working fine until I upgraded to version 0.5.0 + WP 2.5. Now in the Widgets page I get this error:

%BEG_OF_TITLE%Categories%END_OF_TITLE%
Fatal error: Call to undefined function buildparental() in [...]/wp-content/plugins/wp23_folding_cats.php on line 781

Any ideas? Thanks!

Josep M Posted on Monday 24th March 2008 at 7:37am Comment

Hi,
I&squot;m just testing your WP Folding Categories widget. Apparently you can&squot;t select for a blog a category and its subcategory? (say my post belongs to Music and of course to Arts, but somewhere I want to display all the Art related posts, and somewhere else only the Music related posts).

ctraos Posted on Monday 17th March 2008 at 7:36pm Comment

okk, muchas gracias !!

Kent Posted on Sunday 16th March 2008 at 3:11pm Comment

I love this plugin very much, bit would like to have multiple instances, 2 or 3 anyway. In the situation of the Dutch site mentioned I want to seperate &quot;Coolstuff nl&quot; categories fromthe rest.

Yi Posted on Sunday 16th March 2008 at 1:32am Comment

I have a problem with using the widget. Everything is fine, except that when I few single posts, the bolded child category and expanded parent category is the wrong one. In fact it always seem to show the same category (the first category) for all the posts when you view single posts. You can see an example of this on my blog.
Everything else works splendidly though and I really appreciate this plugin. So thanks.
Can you email me about a fix or an explanation?
Thank you.

Nathan Posted on Friday 14th March 2008 at 11:19pm Comment

I&squot;m wondering if you category plug-in can display only the sub-categories once a category is selected off the main page.

For example:

Fruit
Cars
Books

I click Fruit..

Now the categories are only:

Apples
Oranges
Grapes

All the other ones are hidden.

Is this possible?

Nathan

.45 Posted on Monday 10th March 2008 at 7:53pm Comment

I was wanting to use desc. in the tree since I&squot;ve optimized category names for SE. Possible feature request.

.45 Posted on Monday 10th March 2008 at 3:12am Comment

A perfect solution without requiring JS. I especially like the highlighting of posted cats. Only thing I can’t seem to make work is “Category Description as title”.

A nice option for me would also to embed a homepage link to easily navigate back.

mikh Posted on Thursday 6th March 2008 at 7:23am Comment

In “download” box you should change date (now it is 2007 year)

mikh Posted on Thursday 6th March 2008 at 7:04am Comment

Great plugin! Thank you very much!

Could you explain where within DB menu tree is stored when &quot;Use cache for building menu tree&quot; checked? What should be done in case I decide to deactivate plugin? Should I clear DB manually or not?

(I like plugin very much but now I make site for other people, so they need to know their database will not be affected in some way after possible deactivation any of using plugins)

Thank you, again

Mikhail

banji Posted on Sunday 2nd March 2008 at 10:46am Comment

I am trying out your category plugins, and I would like to have them on my blog and function like yours in this blog.

However, I can’t seem to be able to make it work.

If you’d be so kind and reply this via email. Thanx for your attention

main Posted on Thursday 28th February 2008 at 1:48pm Comment

i have problems with the symbol &

great plugin!

Queeneve Posted on Saturday 23rd February 2008 at 7:39am Comment

great great great plugin , that is exactly what i needed
thx

Gravatars Lonewolf Posted on Tuesday 12th February 2008 at 11:55am Author

Ian, I have added this as a feature to the next version.

Nathan Posted on Monday 11th February 2008 at 12:57pm Comment

Hi,

Im interested in your Folding Category Widget.. but am wondering if there is a way to only display the sub-categories based on the main category being viewed.

For example, the blog home (root) would only display the top level categories.

Once a top level category is clicked, the only categories displayed are the sub-categories related to the top level category that was clicked.

Same with single posts — incorporating the idea of prioritizing the higher category ID.

Is this possible with your module?

Thanks,
Nathan

Ianr Posted on Saturday 9th February 2008 at 6:35pm Comment

Is there an easy way to expand ALL categories that a post is in? I wan’t people to see how others have categorized something.

daniel Posted on Saturday 2nd February 2008 at 11:41am Comment

how do i get the + and - to work? YOu say smt about CSS; but could you elaborate? Im looking for a follow-up from http://dragonflyeye.net/javascript-collapsing-categories/

John Posted on Monday 14th January 2008 at 1:59pm Comment

Great widget. You can see it working on my weblog. Its in Dutch but…Thanks

Gravatars Lonewolf Posted on Thursday 10th January 2008 at 11:53am Author

Neil, this is a problem with PHP 4 not supporting XML. I have re-written to include support. Please download the latest version and try again.

Neil Posted on Thursday 10th January 2008 at 6:15am Comment

Thank you for you cool folding categories plugin for WP. I have installed it in my website however I get the following error

Warning: domdocument() expects parameter 2 to be long, string given in /wp-content/plugins/wp23_folding_cats.php on line 105

Fatal error: Call to undefined method: domdocument->loadxml() in /wp-content/plugins/wp23_folding_cats.php on line 107

You mentioned on the WP website that if someone received this error you would like to know.

Thorsten Kaluza Posted on Monday 10th December 2007 at 9:57pm Comment

Hi,

this is some nice pluging.

I installed it on my site but its showing a mysql error.

WordPress database error: [Table dldpromo_wordpressdb.wp_term_taxonomy doesnt exist]
SELECT * FROM `wp_term_taxonomy` JOIN `wp_terms` ON wp_terms.term_id = wp_term_taxonomy.term_id WHERE wp_term_taxonomy.taxonomy = category ORDER BY wp_terms.name ASC

Do you know how i can resolve this?

Any help is appreciated. :-)

Thanks in advance and god bless.

Thorsten

Klaus Posted on Saturday 10th November 2007 at 4:45pm Comment

Nice work. Would be even nicer if thered be the otion to add individual classes to each category. Is there a chance?

Regards.

 

Have Your Say

 

 

 

 

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment. The authors reserve the right not to publish any comments that they believe are hateful, racist, demeaning or otherwise inappropriate.

    www.flickr.com
    This is a Flickr badge showing public photos and videos from Tim Trott. Make your own badge here.
  • Recent Additions
  • Search




  • Page copy protected against web site content infringement by Copyscape
This page was last updated on Monday, July 28th, 2008.
Unless otherwise stated, all photographs and content Copyright © 2000 - 2008 Tim Trott, All Rights Reserved. No graphics, photographs or content may be used without written permission.
Website Design and Graphics Copyright © 2005-2007 Tim Trott. home :: sitemap :: disclaimer:: contact