You can use this in your themes to add additional information on your taxonomy/term/x pages ;
<?phpfunction get_tax_from_arg ($vid) {
if (arg(0) == 'taxonomy' && arg(1) == 'term') {
$tid = (int)arg(2);
if(is_numeric(arg(2))) {
$term = taxonomy_get_term($tid);
if(is_object($term)) {
if($vid == $term->vid) {
$name = $term->name;
return $name;
}
else return;
}
else return;
}
}
}// use like this - print get_tax_from_arg(1), where 1 is vocabulary id?>
0 comments:
Post a Comment