In Drupal, you can provide a description for each term in a taxonomy vocabulary. The default taxonomy term pages of Drupal 6 include the description at the top of each page (if only one term is present). Here's how you can achieve the same thing when using views.
- Make sure your theme has a page.tpl.php file. My theme is a subtheme of Zen so I copied the page.tpl.php file from the zen folder into my theme's folder.
- Create a duplicate of your theme's page.tpl.php file and call it page-taxonomy.tpl.php.
- Edit the new page-taxonomy.tpl.php file and add the following where you want the description to appear (for example at the end of the content-header):
<?php if ($taxonomy_term_description): ?> <div id="taxonomy-term-description"> <?php print $taxonomy_term_description; ?> </div> <?php endif; ?> - Edit your theme's template.php file and add the following function:
function yourtheme_preprocess_page(&$vars, $hook) { $term = taxonomy_get_term(arg(2)); $vars['taxonomy_term_description'] = filter_xss_admin($term->description); }
After you clear your theme registry - by visting the admin/build/modules page - the term description will be displayed at the top of the page showing your taxonomy_term view.

15 Comments
It there a way of doing the
Submitted by mik on
It there a way of doing the same in Drupal 5?
There probably is, but I'm
Submitted by litrik on
There probably is, but I'm no longer using Drupal 5 so I'm not 100% sure.
How do I accomplish this in
Submitted by Andy Base on
How do I accomplish this in Drupal 7?
I couldn't find any change
Submitted by litrik on
I couldn't find any change in Drupal 7 that might break my code so I guess it works out of the box in D7 (if the Views module works in D7, which is a much bigger assumption).
Feel free to test it and let me know.
I'm guessing the new
Submitted by Matthew Davidson on
I'm guessing the new database abstraction in D7 will mean Views will have to be extensively rewritten (again).
Or just put this in the view
Submitted by Guix on
Or just put this in the view header (first enable the PHP filter module) :
<?php
if (arg(0) == 'taxonomy' && arg(1) == 'term' && is_numeric(arg(2))) {
$tid = (int)arg(2);
$term = taxonomy_get_term($tid);
print (filter_xss_admin($term->description));
}
?>
Guix, thank you! thank you!
Submitted by Anne on
Guix, thank you! thank you! thank you! I'm not sure why it's so hard to find this, but it's exactly what I needed.
Thanks! I spent a long time
Submitted by Jane on
Thanks! I spent a long time looking for something like this and it is exactly what I needed.
thk you!
Submitted by Anonymous on
thk you!
Thanks for sharing this nice
Submitted by Anonymous on
Thanks for sharing this nice tip. This also a nice example of how to use of preprocess functions and vars.
Thanks a lot for this post!
Submitted by maya on
Thanks a lot for this post! It' been very useful to me. Great!!!
I have another problem... maybe you could have the right solution: I have associated an image to each taxonomy term, using Taxonomy term module, but these images are not displaied in the view. Any idea to make them visible in the taxonomy term's associated views?
Thanks!
Sorry! I've made a mistake
Submitted by Anonymous on
Sorry! I've made a mistake in my post: I've associated images using TAXONOMY IMAGE MODULE, non taxonomy term module... sorry!
I'm trying to redesign my
Submitted by Lindsay on
I'm trying to redesign my website in Drupal and it is harder for me than I expected that will be. Fortunately, I find these useful info and you saved lot of my time! Thanks a lot!
both solution aren't working
Submitted by snicers on
both solution aren't working if more than one language is enabled and the term description has a translation.
I can browse the taxonomy
Submitted by pay per click m... on
I can browse the taxonomy fields but they all display (0) and when I reach the finish it turns up empty. What am I doing wrong? Thanks,. Michael