Guest User

Untitled

a guest
Jul 18th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. // add this into your Template.php drupal theme
  2.  
  3. function getTerm($vid, $link, $node, $tagsymbol, $labelname) {
  4. foreach((array)$node->taxonomy as $term){
  5. if ($term->vid == $vid){
  6. if ($link){
  7. $link_set[] = l((($tagsymbol)?$tagsymbol:'') . $term->name, taxonomy_term_path($term));
  8. } else {
  9. $link_set[] = (($tagsymbol)?$tagsymbol:'') . $term->name;
  10. }
  11. }
  12. }
  13.  
  14. if (!empty($link_set)){
  15. $link_set = (($labelname!=false)?$labelname:'') . implode('', $link_set);
  16. }
  17. return $link_set;
  18. }
  19.  
  20.  
  21. //Add this into your node.tpl.php or node-NODETYPE.tpl.php each time for your vocabulary's terms
  22. print getTerm(1, true, $node, '#', 'Tags: ');
  23.  
  24. // In example
  25.  
  26. print getTerm(2, FALSE, $node, '', 'Topics: ');
Add Comment
Please, Sign In to add comment