Community & Support

How to create tpl for each vocabulary taxonomy term?

How to create tpl for each vocabulary taxonomy term?

Comments

snippet

<?php
// Add this to your theme's template.php
// Replace "garland" with your theme's name
function garland_preprocess_node(&$vars) {
  foreach (
$vars['node']->taxonomy as $term) {
   
$vars['template_files'][] = 'node-term-'. $term->tid;
  }
}
?>

Then, you can create special templates for each taxonomy term. For example, a template named node-term-3.tpl.php would take over on nodes where the taxonomy ID is 3.

I'm not sure if this is what

I'm not sure if this is what I have been looking for but maybe I can use it to solve my question here http://drupal.org/node/669928. Please tell me yes or no?

Is there a way to make this

Is there a way to make this work with content types also?
So something like node-newcontenttype-term-termnumber.tpl.php
Thanks

nobody click here