19th Street Design is now Greg Willis Industries!

Head on over to the new website for updated information and the new contact form. I'll keep this old website up until the summer of 2012. Make sure you update your links to the new site. Thanks!

Adding a Separator in Drupal Taxonomy Terms

Out of the box the Zen theme displays the taxonomy terms of a node as inline links with no separators. If you want some text dividing the terms, try the following:

In your theme's node.tpl.php file there should be some code that looks like
<?php print t(' in ') . $terms; ?>

Replace that code with

<?php  
  
foreach($node->taxonomy as $tid => $taxo)
  
$taxo_links[] = l($taxo->name,"taxonomy/term/$taxo->tid", array('title' => $taxo->name));
   print
t('<strong>Tags:</strong> ') . implode('  |  ',$taxo_links);
?>

In this example I've used the pipe character (|) as the separator in this section implode('  |  ',$taxo_links). Just replace that '|' with the character of your choice and you're good.

Found this at drupal.org Theming taxonomy terms.

Tags: Drupal Theming | PHP Code

Comments

This helped me a lot

Thank you for this quick how-to, it really helped me! It may not seem like much, but these little tid-bits of information are invaluable resources for beginners like me.

Incidentally, the captcha to post a comment is almost impossible! I've tried about 7 times now, but there's always one letter or number that I get wrong. Might be impeding feedback to your posts - just fyi.

captcha

Thanks for the heads-up -- switched to ReCaptcha

-Greg