‘No SubCats’ Plugin: Take Subcategory Posts out of Category pages
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 NoSubCats, It makes the page links unavailable.
It might not play well with some other plugins or some themes.
For WordPress 2.0.x only Download below.
For WordPress versions 2.1 – 2.9, “Just One Category (1.1): is doing what you need so I refer you there: Just one Category.
For WordPress 3.0 and later Just one Category broke… We modified Just one Category for our use. We can’t assure you it will work for you but you’re welcome to try it and use it until the “real” Just one Category gets updated. Get Just One Category (Modified).
Instructions
- Simply download and unzip it.
- Put it in your plugins directory.
- Activate it.
Download
Version 0.3: Download
Version Log
Version 0.2: Corrects for behavior change in WP 2.0.5 detecting Category ID.
Version 0.1: Initial release for WP 2.0.4.











Works great! Thanks!
thx ….
Hmmm…works only if min. one Post is in the displayed cat. Otherwise i get a 404. :(
Mo
Beautiful plug – in. EXACTLY what I was looking for. Thanks for this contrib!
This is not working for me. I have ‘Category Visibiliy’ also running (works great!) but this part is not working (as i understand it).
hi, thanks for this very nice plugin! It works for me, of course. Can you tell me how to change the code so that the plugin does NOT effect on 1 or 2 certain cats?
Category Visibility works great. NuSubCats is another thing I was looking for. However, I can’t find were to switch on and of the subcategories. It might be a bug, but more likely I’m just blind. Can you help me with this? Regards, Bas
Hi man, I recently download this plugin and want to say you that he is good, but I have same question that bas from previous comment. Can you help me too?
If it’s going to work for you, the subcategories will disappear from the parent page simply by activating the plugin. As per instructions above.
Hey, it seems that when I choose to show the ‘number’ of posts in the parent category, the parent category displayed is 1 more than the number of posts indicated — due to the filtering of your NoSubCat plugin.
Hope, you can get this plugin update, since having a post in the parent AND subcat is one of my ‘big’ pet =P. This results in duplicate content, as you may know it. Anyway, hope this plugin will get developed more.
Awesome job on this plugin.
Does anyone know if this still works with WP 2.3?
Thanks.
No it is apparently NOT working with WordPress 2.3! I got weird error messages complaining about the table wp_post2cat being not present when it was activated. Sad enough – the plugin was very good…
Are there any plans to update this so it works with WordPress 2.3?
Thank you,
Brian
Sorry, no plans for 2.3… I can’t complain that WP is advancing but I’m sticking with 2.0 because I’m unable to keep up with the changes.
Works great, many thanks!
Andy
Are there any plans to update this so it works with WordPress 2.3? Thank you Güzel Kadın
If you’re rockin’ WordPress 2.3 and looking for a solution to keep subcategory posts off your page, I can suggest to you a non-plugin approach:
In the Archive.php file of your theme, looking inside of ‘the loop’, just after the
What you want to do is create a IF STATEMENT to see if the posts that are about to be displayed are actually of that category, or not.
I’m doing this with a piece of code that looks like this:
The full markup, though rough, works great on both category and tag pages (and the such):
” title=”Read “>
Well, even though I used the CODE tags, things didn’t turn out. You can still see the
if ( in_category($cat) )
statement though… good luck
Thi look to be super useful? what about compatibility with WP 2.3.2 ? where I can find a demo of this plug in in action?
I have installed this plugin here: http://www.gioielleriaforli.it/ using wp 2.3.2 uploaded and activated, put nothing happen, what I must do now?
Hi,
Fold Category List can and does support the display of category links where those categories do not contain posts, however not by default. This is in keeping with the old wp_list_cats tag, which also by default does not include empty categories in the category list.
Turning display of empty categories on requires setting ‘hide_empty=0′ in the arguments.
Fold Category List was recently updated (January 2008) to support the WP 2.3 family and can be downloaded from http://www.webspaceworks.com/resources/wordpress/31/
Can someone please give an update to show how to exclude sub-cat posts from the archive pages with Version 2.5?
Thanks
needs update!
finally I found what I need here, waiting for your new update.
Hi all,
I have great message for you – this plugin works and do exactly, what you wants:
http://wordpress.org/extend/plugins/just-one-category/
Just One Category is doing what you need so I refer you there.
http://wordpress.org/extend/plugins/just-one-category/
And am therefore closing comments and development on this plugin.