None of the options I've seen are working.

The simplest seems to be using the Context module:

body class based on taxonomy term can easily be done with the context module. No coding at all:
condition: select the taxonomy term
action: theme html: action class

from this link: https://www.drupal.org/node/1072806

But I'm not seeing any new classes appear on the body tag.

Are there any page.tpl.php or html.tpl.php or functions.php pre-req's that anyone can think of to make this work?

I originally was trying to add a class based on the url to the body tag of a given page but nothing I've ran across here or at drupal.stackexchange has worked.

Comments

cfox612’s picture

Is your theme html.tpl.php outputting the body classes? It should look something like:

<body class="<?php print $classes; ?>" <?php print $attributes;?>>

If not try adding that to your theme.

thumbslinger’s picture

yes, my body tag is as such:
<body class="html not-front not-logged-in no-sidebars page-node page-node- page-node-33 node-type-page section-content">

but I'm not getting any taxonomy terms/vocab etc.

thumbslinger’s picture

I found the solution. For me, in Drupal 7, I had to make sure that generating an automatic url was UNCHECKED on my terms and then my vocabularies and terms showed up as classes.

ryanfc78’s picture

I am trying to do the same thing. Where id you UNCHECK the automatic url option and make them show up as classes?

ryanfc78’s picture

sorry it posted twice for some reason, ignore this one