Just One Category
This plugin will cause WordPress to display on a category archive page only those posts which are direct members of that category, i.e. this plugin will exclude from that category page all posts which belong to any of that category’s subcategories but do not belong to the category itself.
Compatibility:
This plugin requires at least WordPress version 2.3 or higher, and I have tested it with the still-in-development WordPress version 2.6. If you haven’t already, upgrade to the latest WordPress.
Instructions:
- Download the plugin.
- Upload it to your
wp-content/plugins/directory (i.e.wp-content/plugins/just_one_cat.php). - Make sure the file has sufficient File Permissions to be read by your web server (you probably don’t have to worry about this step).
- Activate the plugin called “Just One Category” from your Administration Panel’s Plugin Manager.
That should be it. No configuration is necessary.
Update: This plugin is now hosted on the wp-plugins.org repository. The download link above has been changed to reflect that.

[...] hat category or any subcategory. The plugin is called Just One Category, for displaying only one category on a category page for all you [...]
Your Just One Category plugin seems to break my rss feed for the category.
I was using the /wp-rss2.php?cat=3 to show the rss feed for category 3 and it was working just fine. Now I get these messages when I click on the rss link:
___________________________
WordPress database error: [Unknown column 'category_nicename' in 'where clause']
SELECT DISTINCT * FROM wp_posts LEFT JOIN wp_post2cat ON (wp_posts.ID = wp_post2cat.post_id) WHERE 1=1 AND 0=1 AND (category_id = 3 OR category_id = 4) AND post_date_gmt
I get the flw error on all categories:
WordPress database error: [Unknown column 'category_nicename' in 'where clause']
SELECT DISTINCT * FROM wp_posts LEFT JOIN wp_post2cat ON (wp_posts.ID = wp_post2cat.post_id) WHERE 1=1 AND (category_id = 1) AND post_date_gmt
My page validates as XHTML but when I activate the plugin the page no longer validates.
It wasn’t working because you’re not using Pretty Permalinks.
I’ve updated the plugin so that it should now work no matter the URL you use.
I can only assume your validation errors were a result of the plugin vomiting all over your page.
In the future, note that it’s always easier for someone to help you if you give them a link to your site.
Yes, it works, thank a lot!!! - great plugin, just what I was looking for. Sorry for not including link.
Hello!
I get this error, similar to Henrik… but I *am* using pretty permalinks. What do you think? I have queried specific categories (2,7,10,12,15,17,22,29) to be shown on the homepage. If you need me to re-activate the plugin, I will - in the meantime it is deactivated.
WordPress database error: [You have an error in your SQL syntax near '2,7,10,12,15,17,22,29 GROUP BY wp_posts.ID ORDER BY post_date DESC LIMIT 0, 3' at line 1]
SELECT DISTINCT * FROM wp_posts LEFT JOIN wp_post2cat ON (wp_posts.ID = wp_post2cat.post_id) WHERE 1=1 AND (category_id = 1 OR category_id = 2 OR category_id = 7 OR category_id = 10 OR category_id = 12 OR category_id = 15 OR category_id = 17 OR category_id = 22 OR category_id = 29) AND post_date_gmt
Do you mean that you have restricted the homepage so that only posts of categories 2,7,10,12,15,17,22,29 show up? If so, by what method?
Henrik, no worries. Glad it suits you.
That’s exactly what I mean - I used query posts. Perhaps this is a nasty hack, but I make this stuff up as I go along. :)
I put this before my loop:
Whoops, it’s very early in the morning yet for me. Guess I can’t put php code in my comment.
surrounded by the requisite php tags I have (I hope this works since I can’t seem to preview my comment):
$page = (get_query_var(’paged’)) ? get_query_var(’paged’) : 1;
query_posts(”cat=1,2,7,10,12,15,17,22,29&showposts=3&paged=$page”);
Nevermind - I’ve ended up using front-page-cats to drive the posts on my home page (instead of the god-awful query posts above) and this is no longer a problem.
THANKYOU!! this is just what I was after.. was about to write it myself until I stumbled across this.
[...] Two plugins worth looking at and get tested for my …/emba site which are by Blogwaffe. They are Just One Category and Draft Notifier. • • • [...]
This is great! I wish wordpress had this function natively.
Hello and thank you for your plugin, this is looking to be a life saver. I have a question. How can the plugin be modified so the behavior is not global and work for a specific category and it’s children.
Tried to change this
if ( !is_category() )
to
if ( !is_category(Category Name) )
but that doesn’t do it. Would be really thankful.
BigBerries, The plugin simply is not designed to do what you ask. Without redefining what the plugin is supposed to do (and therefore rewriting the whole thing), the best solution is to:
if ( !is_category('category-slug') )or
if ( !is_category(cat_ID number) )Hi, what a great plugin! But I get the errors that Henrik got above. I tried to change to Pretty Permalinks but I still get the same errors…
Maybe it’s because I use Widgets? I also use WP v. 2.0.6
WordPress database error: [Unknown column 'category_nicename' in 'where clause']
SELECT DISTINCT * FROM wp_posts WHERE 1=1 AND post_date_gmt
Sorry I just realised that another plugin interferad mith yours, it’s a plugin that shows recent posts that generates the errors.
Thanks for this plugin
[...] Just One Category>> [...]
Hi there
Great plugin, I hope to use it. But at the moment my sidebar widget that displays my recent posts is producing this error with your plugin installed:
[Unknown column 'category_nicename' in 'where clause']
SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts WHERE 1=1 AND (post_type = ‘post’ AND (post_status = ‘publish’ OR post_status = ‘private’)) AND category_nicename = ‘podcasting’ ORDER BY post_date DESC LIMIT 0, 5
Any ideas?
Thanks
Dermod
hi, a short questions for you experts:
(I installed the plugin and activated it, but nothing new happens on my website… I hope it works…)
the question is: may I place some code in the ’single post’ page to show a list of all the posts of that same category?
thank you in advance for your help!
I have also had the errors from posts 20 and 21 above.
The post #20 error “Unknown column” I received while using WP 2.2.1 and the post #21 error (nothing happens) I received using WP ME2.2.3
Thanks much. Hope to be able to use this handy plugin.
Matt
I get the following error too:
Tried to deactivate other plugins but no go…
any ideas?
WordPress database error: [Unknown column 'category_nicename' in 'where clause']
SELECT SQL_CALC_FOUND_ROWS wp_posts.* FROM wp_posts INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) INNER JOIN wp_term_taxonomy ON (wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id) WHERE 1=1 AND wp_term_taxonomy.taxonomy = ‘category’ AND wp_term_taxonomy.term_id IN (’6′, ‘8′, ‘7′, ‘9′, ‘11′, ‘10′) AND post_type = ‘post’ AND (post_status = ‘publish’ OR post_status = ‘private’) AND category_nicename = ’services’ GROUP BY wp_posts.ID ORDER BY post_date DESC LIMIT 0,1
This plugin isn’t compatible with WordPress version 2.2 or greater. I’ll see if I have some time to fix it up over the next couple weeks.
How is it going MDA, already fixed the problems?
Still not working for me though :(
The plugin now works with WordPress 2.3 or greater.
You should upgrade to WordPress 2.5.1 if you haven’t already.