Charles Yeung
Charles Yeung

Reputation: 38805

Get term name by term id

I have a term product with term id 123.

How can I use the term id 123 to get the term name?

Upvotes: 0

Views: 4568

Answers (2)

Vikram
Vikram

Reputation: 3351

place this function in template file

function getTermsName($taxnomyid){
$terms =  taxonomy_get_term($taxnomyid);
$termsname = $terms->name;
return $termsname;
}

and use <?php echo getTermsName($taxnomyid); ?> to print term name wherever you want $taxonomyid is your term id

Upvotes: 0

Related Questions