Current Menu state by category for posts


I have 2 category pages listing posts by “News” and “Resources”.

I have everything working fine except none of the posts show a current menu state when viewing. I would like news posts to show a current “News” state in the menu bar. Same for “Resources”.

Is there a way to identify the post to assign it a current menu state in the main nav? (IE. Is it possible to assign a “category-news” class to the body for example?)

Hello there,

Please try this plugin which might help you to add a unique body class name based on the category has been assigned to the post.


Thanks Kharis,

That plugin didn’t work but I figured it out. I was able to modify a child of the functions.php template to add a page identifier to each page. That did the trick!