‘RYO Just One Category’ Plugin: Take Subcategory Posts out of Category pages

RYO Just One Category Plugin makes sense for many of use who use WordPress.

I thought it was bad form to have a category page that included subcategories. With all that, it was a mess.

After all, subcategories get their own page! Those posts don’t need to be in both places!

So I needed to filter out subcategories.

See all of our WordPress Plugins

And I couldn’t just filter them out of archive.php … that disturbed the number of posts per page, sometimes leaving continuation pages with nothing on them! We needed to change the query.

This plugin solved the problem for me; I hope it helps you, too.

It works great with the Category Visibility plugin (our version).

It works fine with the Fold Category List plugin as long as you have a Post in the parent category. Otherwise the subcategory links will not appear in the sidebar. While this does not actually affect the performance of RYO Just One Category, It makes the page links unavailable.

It might not play well with some other plugins or some themes.

We were using a plugin called “Just One Category” to handle this but after WordPress version 3.0 it broke… So we wrote our own version, nice and clean, using code similar to what we did with Category Visibility. It’s an entirely different approach, more likely to last through future versions of WordPress.

How does it work with a post assigned to multiple categories? Frankly, I’m not sure because that’s not how we organize our websites. What I think we did was make it so a post signed to a subcategory won’t appear. So if you have a category ‘Disney’ and another category ‘Disneyland’ where ‘Disney’ is selected as parent, I think a post assigned to both will show only in the child subcategory. Try it and report what you discover back here.

Download it below.

Instructions

  1. Simply download and unzip it.
  2. Put it in your plugins directory.
  3. Activate it.

Download the latest version

Get RYO Just One Category Plugin

27 Responses to ‘RYO Just One Category’ Plugin: Take Subcategory Posts out of Category pages