I'm developing a site using Wordpress which uses Categories for main sections with sub categories. Each main section is styled differently so I'm using the parent category slug for each sub category to add an id to the body tag. This works fine and allows all sub category pages to be styled the same as their parent category.
My issue is when you load a single post from a sub category page it uses the single.php template and I need to load the posts parent category slug into the body tag as an id so I can style the post in the same way as it's category page.
As an example the sort of structure I have is News as a parent category with Press Releases and Latest News as sub cats.
Help much appreciated!