Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save domenicomonaco/758704 to your computer and use it in GitHub Desktop.

Select an option

Save domenicomonaco/758704 to your computer and use it in GitHub Desktop.
init committ
// add this into your Template.php drupal theme
function getTerm($vid, $link, $node, $tagsymbol, $labelname) {
foreach((array)$node->taxonomy as $term){
if ($term->vid == $vid){
if ($link){
$link_set[] = l((($tagsymbol)?$tagsymbol:'') . $term->name, taxonomy_term_path($term));
} else {
$link_set[] = (($tagsymbol)?$tagsymbol:'') . $term->name;
}
}
}
if (!empty($link_set)){
$link_set = (($labelname!=false)?$labelname:'') . implode('', $link_set);
}
return $link_set;
}
//Add this into your node.tpl.php or node-NODETYPE.tpl.php each time for your vocabulary's terms
print getTerm(1, true, $node, '#', 'Tags: ');
// In example
print getTerm(2, FALSE, $node, '', 'Topics: ');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment