Building Your Website, Step-By-Step

RYO Folding Category List & Widget

RYO Folding Category List provides a sidebar widget that displays only top level categories
plus parents and children of current categories in category archives and in Posts. If your website
has lots of categories, this can simplify your sidebar real estate considerably by displaying
only categories of current interest.

The widget's user interface lets you set the displayed title. It displays your categories and lets
you designate which categories should be excluded entirely from the list.

I once used a rather complex function called Fold Category List. It took a long path to do the same thing that wp_list_categories() does. And it didn’t upgrade well. Here it’s redone with entirely new logic that makes it fast and clean, plus there’s a powerful widget with lots of customization options.

Requires at least: WordPress 2.8

See all of our WordPress Plugins

Installation

  1. Download and unzip ryo_folding_category_list.zip. This will unzip to a folder called ryo_folding_category_list.
  2. Upload the ryo_folding_category_list folder to the /wp-content/plugins/ directory.
  3. Activate the plugin through the 'Plugins' menu in WordPress
  4. The user interface is in the Appearance, Widgets section of the Dashboard. Customize the display there.

With WordPress 2.8 or later you can use the plugin "Upload" utility to upload and install the plugin.

Download

RYO Folding Category List ver. 2.0.1

Screenshots

Widget on Front Page
1. This is the display of the widget on the Front Page. Top level categories only are shown, excluding
any that were checked in widget options.

This image reflects our theme, of course. Your website will be styled as defined in your theme.


Widget on Do It Yourself Page
2. This is the display of the widget when you select the "Do It Yourself" category or any Post in that category. The top level categories are still displayed, plus the children of
"Do It Yourself." Children of other top level categories do not appear.

This image reflects our theme, of course. Your website will be styled as defined in your theme.


Widget Options Panel
3. This is the widget drop down options panel, illustrating how you may choose to exclude listed
categories.


Frequently Asked Questions

Can I have more than one instance of the widget?

Yes, the current widget system allows for this.

This would allow you to have a completely separate block in your sidebar for unrelated categories.
It might require customization of each widget as Categories are added. But one easy way to do this would be:

  • Folding Category Widget #1: Exclude Categories D, E, F.
  • Folding Category Widget #2: Include only D, E.
  • Folding Category Widget #1: Include only F.

This lets you put certain Categories (D, E, and F) in special places on your website. If you add another
category which you want to appear in Widget #2, you'd have to add it to Widget #2 and Exclude it from Widget #1.

When I select a subcategory, will other subcategories on the same level be hidden?

That's up to you. In normal operation, subcategories on the same level (also called "siblings") will
be hidden. This means one has to go to the parent in order to choose a subcategory.

If that's not what you want check the "Include Siblings" checkbox and the other categories with the same parent will also be displayed.

Changelog

2.0.0

  • Initial release.
  • Complete rewrite to use WP internals available in WP 2.8+. Not compatible before WP 2.8.
  • New logic eliminates most database queries; more efficient, less overhead.
  • Based on original idea by Rob Schumann (http://www.webspaceworks.com/) but with entirely new logic.

35 Responses to RYO Folding Category List & Widget

  • Uploaded new test version (.03) that adds Option to include siblings in display.

  • This is an awesome plugin. Great work, Rich!
    I’ve got a little question about it: How can I apply my custom CSS-style for chilren categories list? I’ve tried to define “.childen” but it doesn’t work..

  • That’s a theme issue, not this plugin. But probably a “li li” in css under whatever the block ul is defined.

  • Is this working on wp 2.9?

    I installed and added widget to sidebar but it shows just everything, all categories and subcategories, on all pages.

    The Include Siblings box is not ticked. I just can’t make it show only main categories on homepage and subcategories only when you navigate to it’s parent category.

    Any ideas?

  • Me again. I think i found the problem.

    Issue is like this. Let’s say i add 3 categories and each category with 3 subcategories. Right after i add them all, none of them has posts.

    I only add posts to subcategories, main category is just a container and will list only posts from it’s subcategories.

    Now.

    If i add posts to all subcategories, it will all be fine. Subcategory will not show on main page or on other category page.

    But as long as a subcategory is empty, it shows everywhere.

    If i tick Hide empty categories box, it does not help. I see no categories at all, because it hides parent categories, that are always empty, and along with them it also hide the child subcategories.

    So, i think will be nice if by default not show empty subcategories at all or just show it when you click on parent category, as when it has posts. Or even better, an option in widget to Hide empty subcategories.

  • Was looking forward to using your widget, but I added it into my sidebar and it does not show up in the sidebars on my site. Can’t figure out why not. I moved it around to other sidebars, but it just won;t show. Nothing wrong with my categories and other category widgets show them.

    WP 2.9.2.

    Any ideas?

  • Using an empty category as a parent has always been a challenge in WordPress. My solution has been to create one Post for the category, generally with pointers to the child categories.

    And, of course, use a plugin like Just One Category to keep children from showing up on parent pages, which tends to negate the whole idea of child categories.

  • Wait, I see now that it shows up on individual posts (just the categories in for that post), but not on other pages, like the home page. Is that right?

  • Me again, sorry. I got it now. I had to uncheck both option — include siblings and show empty cats.

    Thanks for the plugin!

  • Rich, thank you for this widget, of all the folding category or collapsing category or whatever nomenclature was used to describe getting the categories in some kind of order as the number grew, yours seems to be the best. The only thing I can think of that I saw working in a different widget (though in the end it was a nice feature but the thing itself is too unpredictable) is having a post count in each category, which yours does not do. Still, great work, and thanks again

  • Andre,

    Seems like a reasonable request. See Beta .06

  • Hi Bro!!

    Just I have install and active the pluggin in my site…. How can call the widget in mi SideBar Box the Categories and Post???

    Thnks Bro… Grettings From Colombia!!

  • John Harry,

    I’m not sure I understand the question, but after you place the widget in the sidebar (in Appearance, Widgets) you can set the title to anything you want.

  • Mhnn .. Bro Rich!!…

    I like that this widget appear in my WordPress front Page!… and help me to organize mi tree categories and posts!!..

    Just teh widget is correctly install in my admin site.. burt i can not organize de categories wuith the widget…
    How i can this!!.. or how invoke this???

    Thanks friend

  • Another thing!..

    My Custom theme support widgets .. but i can that the function widget appear in my box section and organize de tree.. but this widget no work for me… I think that i need same PHP Code to invoke this or I need create a function to view this in mi home page!!

    Thanks for your support Friend!!

  • John Harry,

    The “Folding” category thing is just a way to hide child categories when they are not the focus…

    To rearrange the Category Order I use Category Order.

  • I have been using your plugin with success. Very nice. But now I want to restructure my categories and am having a problem see how I can do it.

    My site is about online college lectures. The categories now are all subjects — math, english, etc. They all exist as parent categories, except that some have childs as well. So, every category term is listed in the widget (except uncategorized).

    You can see this at http://www.virtualprofessors.com

    But now I also want to add Instructor to the categories. So, I’m going to have to create two top-level categories, Subject and Instructor. I’ll go into all the Subjects I now have and specify Subject for their parent. Then I will add the instructors as childs under the Instructor parent.

    With this structure I don’t know how to use your plugin. I would have to unselect every new instructor (and there will be hundreds, then thousands of them) for it to show just Subjects. Then I will have to do another instance of your widget to do the same with Instructors. This is a lot of work and a huge list to keep up.

    In addition, will my Subjects top-level category look like a level in your widget, with all my subjects looking like children? If so, that would look odd.

    The fix for this would be to be able to specify in the widget, the category parent to begin with. So, I’d do one widget with Subjects as the starting point, and another with Instructors as the starting point. I’ve seen other plugins do something like this. Can you add that field? It would seem this would be beneficial for more people than me.

    If you can’t can you give me a hack I can do?

    Or maybe I’m just missing something. :)

  • Mark,

    Just set it to EXCLUDE the categories you want excluded, which, if I understand it, would be Uncategorized.

    And it will work.

    I think you may have missed the point of “folding.” If you have two top levels, Subject and Instructor, that’s all that will show. Until someone clicks Subject. Then the Subjects will “unfold.” If the click Instructors the subjects will fold back up and the Instructors will “unfold.” That’s the point of this plugin.

    Though, if you add thousands of instructors as categories that’s a pretty long sidebar, no matter how you style it!

    If you could categorize the Instructors somehow, it could help. Maybe by A, B, C, D, etc, using the first letter of their last name.

    Then when you click on D all the D-names would appear.

    What it will look like depends on your theme.

    Try it.

  • Thanks for the quick response.

    Actually, I mispoke. On the Instructors widget, I’d just use a standard dropdown category display for that section.

    But that still leaves me with unchecking all the instructors for the Subjects widget, no?

    (You might see something odd on my site while I mess with this, and I might be experimenting with another plugin as well.)

  • Mark, Probably not. I think that if they can’t see Instructors, they can’t see the children.

  • I don’t get it, it looks just like the normal categorie widget from wordpress. Is it supposed to animate or fold or something ? why does this not work. WordPress 3.01…

  • I just want the months to fold/unfold and show the posts…

  • Yes, it “looks” like the normal widget. But you have more control. It’s not an animation. It just hides child categories unless you’ve chosen a parent. Then the children show up for that category. This way, you can have hundreds of categories, but only see the top level and relevant categories to what you’re viewing now.

  • That’s not what this plugin does.

  • Hello, Rich.

    Nice plug-in. Just to make sure – If I hide siblings, after clicking on the first level category – shall I be redirected to the category pgae? And Shall siblings be shown?
    Thanks

  • Tatiana,

    No redirects. It only determines what links show in the sidebar.

  • A really nice and clean plugin.
    I place two feature requests i would love to see. So if you plan to update please consider them.

    1. Styling of the li tags of the categories when on a post page (so we can make them per example bold. lets say and and so on (i know i can do that outside the plugin but would be nice if the plugin already could do that).
    2. Some js expand/unexpand of the child categories

    thanks for that nice plugin (why is it not in the WP directory?)

  • Hi, thanks for this interesting plugin. Is it still updated?

    I’ve just tried it on a WP 3.3.2 site and it seems to behave somewhat odd. I’ve got a setup like this:

    Cat 1
    – Cat 1.1
    — Cat 1.1.1
    — Cat 1.1.2
    – Cat 1.2
    — Cat 1.2.1
    — Cat 1.2.2
    – Cat 1.3
    — Cat 1.3.1
    — Cat 1.3.2

    But when I go to Cat 1, instead of showing:

    Cat 1
    – Cat 1.1
    – Cat 1.2
    – Cat 1.3

    it’s showing:

    Cat 1
    – Cat 1.2
    — Cat 1.2.1
    — Cat 1.2.2
    – Cat 1.3
    — Cat 1.3.1
    — Cat 1.3.2

    In short, it seems to be missing 1.1 and shows children of 1.2 and 1.3, even though they’re not active.

    Not sure if this is due to other plugins, our theme, or if this plugin is clashing with later WP versions?

  • Karl, First report I’ve had of this.

    The design is to set certain categories to be excluded while not interfering with other excluded categories… another plugin could set exclusion or (possibly) set the list to include certain categories and it would change the result.

    You could try temporarily deactivating all other plugins and see if there’s a change.

  • Dont suppose theres a version of this that allows fold/unfold child pages in the sidebar menu?
    That would be a godsend

  • You mean Folding Page List plugin available here doesn’t do that?

  • Hi Rich,

    I tested your plugin and it seems to work fine.
    However, and I hope you can help me here: I’m looking for a way to implement plugin functions but in a page content.
    Do you know any plugin that do that?

    Thanks

  • Try our RYO Folding Page List plugin

  • Hi Rich,

    What I meant is not showing a page list, but showing categories as content and not as widget.

Leave a Reply

Your email address will not be published. Required fields are marked *

Member Center
UserID:

Password:


Ads

Your Own Dot-Com Domain
cinderelladomains.com
Our Recommended Source for Securing Your Domains. Fast Registration, Direct Support Phone

Reliable Website Hosting
siteground.com
Small businesses often use Shared Hosting and the "GrowBig" plan. Free LetsEncrypt SSL included.

Create Your Own Graphics
razataz.com/graphicshb
Website headers and banners are easy to do yourself when you have this inexpensive tool!

Do Your Own Webinars
webinarjeo.com
Unlimited Webinars. Unlimited Attendees. Unlimited Scalability. True Live-Streaming Performance