By default, WordPress has an “uncategorized” category with a sample post. You may want to hide posts in the “uncategorized” category or default category if you’ve renamed it.
Instructions: Add the following code to the functions.php file of your WordPress theme to hide posts in the “uncategorized” category or the default WordPress category with any name.
<?php // Hide the display of something if it has the category named "Uncategorized" if( !in_category( 'Uncategorized' ) ) { // do something like: the_category( ', ' ); } // Hide the display of something if it uses the default category, initially named "Uncategorized" if( !in_category( 1 ) ) { // do something like: the_category( ', ' ); } ?>
You may also enjoy listing some posts for each category.
[code][/code]
Comments Leave a Reply