Home ›
Displaying taxonomy terms differently according to their vocabularyDisplaying taxonomy terms differently according to their vocabulary
Submitted by Benjamin Melançon on January 26, 2009 - 1:15pm
This is how one would embed it in a node.tpl.php, but this should all be done in a pre-process function instead.
<?php
// here it is all together, expect normal typos:
$normal_terms = '<div class="normal-terms">';
$special_terms = '<div class="special-terms">';
foreach ($taxonomy as $tid => $term_object) {
$term_name = $term_object->name;
if ($term_object->vid == 3) {
$special_terms .= '<span>' . $term_name . '</span>';
}
else {
$normal_terms .= ' ' . $term_name;
}
$normal_terms .= '</div>';
$special_terms .= '</div>';
?>
Resolution
Searched words:
treating taxonomy terms differently according to their vocabularies
theming Drupal terms by vocab
Comments
Post new comment