Almost a year ago I wrote a tutorial about How To Separate Drupal Taxonomy Terms Output By Vocabulary (which is the third most popular post on this blog to date!), the technique desribed in the tutorial was useful for Drupal 6, but not for Drupal 7. I got some requests to explain How To Separate Taxonomy Terms Output By Vocabulary in Drupal 7 and here it is. The explanation. In Drupal 7 a lot of things changed including the way how we attach taxonomies to nodes and display node 's contents. Taxonomies are now attached as fields , so after creating a Vocabulary you:
Note the difference between D6 and D7? Now you can add as much 'term reference' fields as you want and each Term reference field means a separate Vocabulary.
Ok, now if you create a node and assign terms from both vocabularies, you will note that terms aren't separated. How do we separate them and output in different parts of the theme?
to any part of the template to output our first vocabulary and put
to output our second vocabulary. _One important thing to note: if you 're going to output one of the vocabularies after the main content render happens ( render($content); ), then you need to put this string before the main content output call: _
_hide($content[ 'field_tags']); _
_(as an example). By doing this, you 're hiding a vocabulary from the main content output preventing it from unwanted rendering._
Well that's all, compared to Drupal 6, the approach in Drupal 7 became more flexible, intuitive and requires less code! Hooray to Drupal 7 :)