WordPress 2.0 ‘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
Instructions
Simply download and unzip it.
Put it in your plugins directory.
Activate it.
Download
Version 0.3: Download
Version Log
Version 0.3: Corrects for behavior change in WP 2.1 detecting Admin pages.
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.


























December 8th, 2006 at 1:23 am
Works great! Thanks!
January 17th, 2007 at 7:28 am
thx ….
January 17th, 2007 at 7:43 am
Hmmm…works only if min. one Post is in the displayed cat. Otherwise i get a 404. :(
Mo
February 2nd, 2007 at 4:10 pm
Beautiful plug - in. EXACTLY what I was looking for. Thanks for this contrib!
April 9th, 2007 at 6:18 pm
This is not working for me. I have ‘Category Visibiliy’ also running (works great!) but this part is not working (as i understand it).
April 12th, 2007 at 4:13 am
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?
June 6th, 2007 at 11:27 am
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
June 13th, 2007 at 2:09 am
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?
June 13th, 2007 at 6:57 am
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.
August 10th, 2007 at 12:17 am
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.
September 20th, 2007 at 9:14 pm
Awesome job on this plugin.
September 27th, 2007 at 8:36 am
Does anyone know if this still works with WP 2.3?
Thanks.
September 30th, 2007 at 3:54 am
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…
October 8th, 2007 at 3:44 pm
Are there any plans to update this so it works with Wordpress 2.3?
Thank you,
Brian
October 8th, 2007 at 4:55 pm
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.
October 18th, 2007 at 6:09 am
Works great, many thanks!
Andy
November 27th, 2007 at 2:43 am
Are there any plans to update this so it works with Wordpress 2.3?
Thank you
Güzel Kadın
December 7th, 2007 at 11:07 pm
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 “>
December 7th, 2007 at 11:09 pm
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
January 6th, 2008 at 3:45 pm
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?
January 6th, 2008 at 4:34 pm
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?
January 9th, 2008 at 6:58 pm
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 www.webspaceworks.com/resources/wordpress/31/
April 25th, 2008 at 1:18 pm
Can someone please give an update to show how to exclude sub-cat posts from the archive pages with Version 2.5?
Thanks