I want to show the current Taxnomony term name a page is on. what is the php snippet to do this?

Comments

nevets’s picture

Note you need to have a term id for this to work, details of that depend on the page you are viewing

<?php
$tid = 1;
$term = taxonomy_get_term($tid);
print $term->name;
?>
rayver’s picture

How do I get the term ID? It should display the title for Term 1 if its in the term 1 page, and it should display term 2 if its in term 2

placebo333’s picture

since i have the code just in fron of me ;)

if (arg(0)=="taxonomy" && arg(1)=="term" && is_numeric(arg(2))) { 
$tid = (int)arg(2); 
}