5,000+
May 1, 2025
January 7, 2008
Collapsing Categories creates an expandable list of categories and
subcategories. It can also expand to show posts. The primary usage is as a
widget, but you can also use the code in your theme manually if you wish (see
installation instructions)
Options can be set
from the block panel. If you wish to insert the code into your theme manually
instead of using a widget, you can use the following options. These options
can be given to the collapsCat()
function either as an array or in query
style, in the same manner as the wp_list_categories
function.
$defaults=array(
'showPostCount' => true,
'inExclude' => 'exclude',
'inExcludeCats' => '',
'showPosts' => true,
'showPages' => false,
'linkToCat' => true,
'olderThan' => 0,
'excludeAll' => '0',
'catSortOrder' => 'ASC',
'catSort' => 'catName',
'postSortOrder' => 'ASC',
'postSort' => 'postTitle',
'expand' => '0',
'defaultExpand' => '',
'postTitleLength' => 0,
'accordion' => 0,
'catfeed' => 'none',
'taxonomy' => 'category',
'showPostDate' => false,
'postDateAppend' => 'after',
'postDateFormat' => 'm/d',
'useCookies' => true,
'showTopLevel' => true,
'postsBeforeCats' => false,
'expandCatPost' => true,
'debug'=>'0'
);
collapsCat('catSort=ASC&expand=3&inExcludeCats=general,uncategorized')
This will produce a list with:
* categories shown in alphabetical order
* using images to mark collapsing and expanding
* exclude posts from the categories general and uncategorized
`
<?php
echo '
\n”;
?>
`
I use this plugin in my blog at http://robfelty.com
Currently this plugin relies on Javascript to expand and collapse the links.
If a user’s browser doesn’t support javascript they won’t see the links to the
posts, but the links to the categories will still work (which is the default
behavior in wordpress anyways)
IMPORTANT!
Please deactivate before upgrading, then re-activate the plugin.
Unpackage contents to wp-content/plugins/ so that the files are in a
collapsing-categories directory.
Activate the plugin, then simply go the
Presentation > Widgets section and drag over the Collapsing Categories Widget.
Activate the plugin, then insert the following into your template: (probably
in sidebar.php). See the Options section for more information on specifying
options.
<?php
echo "<ul class='collapsCatList'>\n";
if (function_exists('collapsCat')) {
collapsCat();
} else {
wp_get_categories('your_options_here');
}
echo "</ul>\n";
?>
If you want to use images, you can upload your own images to
http://yourblogaddress/wp-content/plugins/collapsing-categories/img/collapse.gif
and expand.gif
There is an option for this.
If you select a sub-category to expand by default, but not the parent
category, you will not see the sub-category expanded until you expand the
parent category. You probably want to add both the parent and the
sub-category into the expand by default list.
Make sure you specify category names, not ids.
category name. How do I fix this? =
If your theme has some css that says something like
that is the problem.
You probably want to add a float:left to the .sym class
Are you using categories or tags? By default, collapsing categories only lists
categories. Please check the options in the settings page (or in the widget if
you are using the widget)
As of version 2.0, there are several default styles that come with
collapsing-categories. You can choose from these in the widget settings , or you
can create your own custom style. A good strategy is to choose a default, then
modify it slightly to your needs.
The following classes are used:
* collapsing-categories – applied to all ul and li elements
* list – applied to the top-level ul
* item – applied to each li which has no sub-elements
* expand – applied to a category which can be expanded (is currently
collapsed)
* collapse – applied to a category which can be collapsed (is currently
expanded)
* sym – class for the expanding / collapsing symbol
An example:
<ul id='widget-collapscat-15-top ' class='collapsing-categories list'>
<li class='collapsing-categories post'><a
href='http://mysite.com/your-website/about-your-own-site/'
title='About your own site'>About your own site</a>
</li>
<li class='collapsing-categories'><span class='collapsing-categories expand'
onclick='expandCollapse(event, "▶","▼", 1, "collapsing categories"); return
false'><span class='sym'>▶</span>Web hosting</span>
<ul id='collapsCat-176-15' style="display:none">
<li class='collapsing-categories post'><a
href='http://mysite.com/your-website/web-hosting/about-webhosting/'
title='About webhosting'>About webhosting</a>
</li>
<li class='collapsing-categories post'><a
href='http://mysite.com/products/webhosting-1/'
title='Webhosting #1'>Webhosting #1</a>
</li>
<li class='collapsing-categories post'><a
href='http://mysite.com/products/webhosting-2/'
title='Webhosting #2'>Webhosting #2</a>
</li>
</ul>
</li> <!-- ending subcategory -->
__experimentalGroup
to group
* bug fix - category description now correctly appears in title attribute
if there is a description for a given category
* implemented a few more changes to work towards internationalization
<
ul>
* fixed bug with get_sub_cat definition problem in WP 2.5. Looks like it
had something to do with nested functions maybe
Fancy Categories Changelog
0.1:
Initial Release
Version | Download | Type |
---|---|---|
3.0.11 | Download | Stable |
3.0.10 | Download | Stable |
3.0.9 | Download | Stable |
3.0.8 | Download | Stable |
3.0.7 | Download | Stable |
3.0.5 | Download | Stable |
3.0.4 | Download | Stable |
3.0.3 | Download | Stable |
2.2.7 | Download | Stable |
2.1.2 | Download | Stable |
2.1.1 | Download | Stable |
2.1 | Download | Stable |
2.0.9 | Download | Stable |
2.0.8 | Download | Stable |
2.0.7 | Download | Stable |
2.0.6 | Download | Stable |
2.0.5 | Download | Stable |
2.0.4 | Download | Stable |
2.0.3 | Download | Stable |
2.0.1 | Download | Stable |
2.0 | Download | Stable |
1.2.2 | Download | Stable |
1.2.1 | Download | Stable |
1.2 | Download | Stable |
1.1.1 | Download | Stable |
1.1 | Download | Stable |
1.0.2 | Download | Stable |
1.0.1 | Download | Stable |
1.0.beta | Download | Beta |
1.0.alpha | Download | Beta |
0.9.9 | Download | Stable |
0.8.5 | Download | Stable |
0.7.1 | Download | Stable |
0.6.6 | Download | Stable |
0.5.10 | Download | Stable |
0.4.4 | Download | Stable |
0.3.7 | Download | Stable |
Development | Download | Trunk |