From the WordPress.org Support forums:
I need to prevent my default category from appearing in the list of category links. Is there a way to hide the default category title, but still display all posts when the user clicks the “blog” (show all) tab?
biodrama
You can use a little CSS added to the end of your style.css file to stop a category title from appearing in the list, in your example, the “Uncategorized” default category can be made to not show up with:
.cat-item-1 {display:none;}
If you want to use a different default category, finds its ID and replace the ‘1’ above accordingly.
9 Responses
9 Comments
This bit of code was used on this blog showcasing beautiful wood furnishings and amazing art pieces. Enjoy!
Worked for me in my WordPress v2.8. It saved a lot of my time. 🙂 So thanks and keep up the good work.
I have been searching for a solution to this for some time now, thank you so much :):):)
@Rebecca Lee – You are welcome! It’s such a nice little CSS trick, too.
Oh my gosh, thank you so much for this code! I’ve been trying to hide the Uncategorized category for months and it was driving me crazy not being able to figure it out. Nothing worked until I found you code. Thank you!!
Thanks a lot, it worked perfectly!!
Salu2!
@Samuel – Great! I’m glad you were able to use this.
You could also use the exclude argument, since the ID for Uncategorized is almost always 1. If it was a crazy install, neither your CSS trick or this would work though, wp_list_categories(‘exclude=1’)
@Pete – Using the exclude parameter will also work, but the exercise was one of using CSS to accomplish the same goal for the sake of those that do not want to delve into the parameters of the ‘wp_list_categories()’ function. Although I do not understand why you think once the category (any category for that matter) is identified that either method would not work?