I want to include something like the the_category function in a WordPress post, which by default echoes a list of links to all categories the post is attached separated by comma, but I want to exclude some categories from listing in certain views. In some cases I have to exclude all children ones from appearing, in others a top category or random specific categories.
Leave a Reply
You must be logged in to post a comment.
Not sure but i think you can try this
Enter this handy function from the WordPress support forums â just add it to your themeâs functions.php file:
Initially, I did have some issues with this function; after some tinkering around, I realized I needed a separator declared in the_category() tag, like a comma, dash, etc. In this case, I was using just a space â
the_category(' ')
â which wasnât working, but swapping it out for a non-breaking space did the trick:the_category(' ').
Credit: http://www.stemlegal.com/greenhouse/2012/excluding-categories-from-the-category-tag-in-wordpres/