If you ever need to exclude a single category from a WordPress page (archives, index, category page, etc) you can easily do so by using a little conditional tag code within the WordPress loop.
The example below will skip over any post that is in the category with the ID of 35:
<?php if (in_category('35')) continue; ?>
<?php the_content(); ?>
<?php endwhile;endif;?>
This can be helpful if you want to not show a particular category in your blog (if you have a category based site setup) - or if you want to hide some categories from your search results.
Comments/Pingbacks/Trackbacks
Add a Comment or trackback from your own site.


robert
January 18th, 2008 at 5:22 pmThat should be IN, not IS, in_category
jzelazny
March 11th, 2008 at 9:55 amGood catch - I have corrected my mistype.