How can I display a term’s name & description for a custom taxonomy within The Loop (single post page template)?
Currently I can show its name like this:
the_terms( $post->ID , 'director', 'director: ');
but can’t get the description
EDIT
I dont want to use extra php coding like:
$directors = get_the_terms($post->ID ,'director');
foreach($directors as $director){
$director_name = $director->name;
$director_desc = $director->description;
}
2 Answers
Have a look at get term()
. This return the name and description for a term.
Here is the axamples given in the codex
Gives you term name: e.g. Term Name Example
$name = $term->name;
Gives you term description: e.g. This is my new cool custom term.
$desc = $term->description;