add css class to html element based on taxonomy? I would like to add class to the HTML element based on taxonomy. Is it possible to do it from inside template.tpl.php or do I need to create needed templates manually? If so, how will my theme know which template it should pick? Thank you
You can do this by adding a preprocess function to your template file that detects if the current node has terms associated with it and if so, populates a variable for the page.tpl.php according to your logic, ex:

function YOURTHEME_preprocess_page(&amp;$variables) {
  if (!empty($variables['node'])) {
    $node = $variables['node'];
    if (!empty($node-&gt;field_tags)) {  

      #your taxonomy logic here, if term matches your case then assign it to variable
      $variables["custom_taxonomy_page_class"];  

    }
}


Then, in your page.tpl.php file in your theme, you just need to add the above variable where you want it in the HTML tag.

&lt;html xmlns="http://www.w3.org/1999/xhtml" class="$custom_taxonomy_page_class"&gt;


If the variable is empty, no class will be output.