Display one category but not others
-
Working on a blog in which post categories serve a couple of different purposes. On any given post, one of the selected categories I want to display as a label at the top of the post (i.e.: “Essay” or “Interview”). But the post may have another category that I do not want to display, a category that functions to display some posts and not others in different locations on the site.
My problem is how — in the loop — to pull the category I want to display as a label (I’d prefer it not be a link, by the way). There are only about five categories I might want to display that way. And really just one I don’t want to display.
So I could see a series of “if” and “elseif” statements. But that seems clunky.
I could also see changing the category structure to avoid this problem altogether, but the blog already exists and has more than 1,000 posts.
Any ideas for a solution?
- The topic ‘Display one category but not others’ is closed to new replies.