How am I able to show a single term of a custom taxonomy in Wordpress?
I have a custom taxonomy, which will always have only one term开发者_C百科 in it, and I want to display it in a custom loop on my home page. I have tried all possible ways, with one (blargh, can't remember which one) I managed to display the term but as a link, which I don't want. I need it as regular text, since I want to display it in my own href, which will link to the place where I want to.
Any ideas anyone? All and any help very much appreciated. This issue is slowing down my development of a custom theme. :(
Get the single term object using get_term($term_ID, $taxonomy)
, or alternatively get_term_by('slug', $term_slug, $taxonomy)
.
The term object will have, among other properties;
$term->name; // the name of the term!
$term->slug;
$term->term_id;
$term->count; // number of objects using the term
精彩评论