Exclude a category displaying under posts:
<?php
foreach((get_the_category()) as $category) {
if (!in_array($category->cat_name,array('cat1_to_exclude','cat2_to_exclude','cat3_to_exclude')) ) {
echo '<a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'</a> ';
}
}
?>
Thanks! However, is there any way to change the code so I can specify what categories to include, as opposed to what categories to exclude? Seeing how my blog has a grand total of 67 categories, of which I would want to exclude 64.
if (in_array($category->cat_name,array('cat1_to_include','cat2_to_include','cat3_to_include')) ) {