Download
Current Version: 0.5.0
Release Date: 2008-03-29
Folding Category Widget (Lonewolf-Online)
Folding Category Widget (Wordpress.org)
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.5.0
- Updated for Wordpress 2.5 support
- Multiple instances of the widget - by popular request!
- Expand all categories that a post is a member of
- Select whether post count shows total number of posts or total unique posts in category
- Use Category Description as display text (some people have two category titles - one for in posts and the other SEO for navigation)
- Add a class to all anchor elements
- Only show sub/child categories of current category
- Add static links before and after list
- Unique CSS id or class names for each instance
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
- Lonewolf Online - Indents and adds an icon.
- C# Tutorials - Indents and adds an icon.
- Your Paranormal - Uses a different colour per navigation level.
- John’s Weblog - uses the fully expanded list with nice icons for sub categories.
- If you are using this plugin in a creative way, drop me a line and I’ll consider adding a link here.
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.













