This took me a while to figure out so I thought I put it up for inclusion into the Views Documentation. I have a view with arguments based on Taxonomy (TermID) and I needed to put the Term Description below the header. Under Arguments |Taxonomy: Term, I set the title to %1. Under Basic Settings | Header, I put the following PHP code:

<?php
$term_name = arg(1);
$matching_terms = taxonomy_get_term_by_name ($term_name);
if (count($matching_terms) > 0) {
  print '<p>'. $matching_terms[0]->description . '</p>';
}
?>

Hopefully it can help someone else out as it took me days to figure it out :-)

Comments

dawehner’s picture

Category: task » support
  print '<p>'. filter_xss($matching_terms[0]->description) . '</p>';

Should be better :)

rschwab’s picture

Title: Adding a sub-title for to the page of a view with taxonomy argument » How to add taxonomy data to the view display
Status: Active » Fixed

Thanks for adding that to the d.o knowledge base wavesailor! I'm sure people working with views and taxonomy will appreciate it.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.