Note: See comments for several alternative approaches, each w different priorities and different results.
By default, taxonomy terms are displayed in the node by the function print $terms
This results in one big array of all taxonomy terms associated with that node, no matter what vocabulary. Sometimes it makes sense to break these up, so that the terms are displayed by vocabulary. For example:
- Topic: foo, bar
- Tags: bat
To do this, use one of the following approaches:
Method A: (Drupal 6 ONLY)
The following breaks up taxonomy by vocabulary, or, if you pass it a vocabulary id (vid) it will print only that vocabulary which corresponds to the vid you passed to it. If you pass it a true or false value, it will also print or not print the terms as ordered lists. Useful for teasers.
Add this following snippet to your template.php
file, minus the php tags
that surround it:
<?php
function yourthemename_print_terms($node, $vid = NULL, $ordered_list = TRUE) {
$vocabularies = taxonomy_get_vocabularies();
if ($ordered_list) $output .= '
'; //checks to see if you want an ordered list
if ($vid) { //checks to see if you've passed a number with vid, prints just that vid