Inspiration For Creative Minds
Home » Labs » How to Exclude WordPress Posts from Uncategorized Category  

Filed under Labs

Here is a WordPress snippet which excludes posts from uncategorized category.

 
<?php
/*
 
 
// WP hide posts from category 'uncategorized' 
 
 
 
*/
 
foreach((get_the_category()) as $category) {
    if ($category->cat_name != 'uncategorized') {
    echo '<a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'</a> ';
}
}
?>
It's only fair to share...Share on Google+Tweet about this on TwitterShare on Facebook
Labs

Posts you may like: