Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wordpress : How Do I get taxonomy name in taxonomy.php?

I am able to display the term of the taxonomy in the taxonomy page, but how do I get the taxonomy , or display the taxonomy on the page.

for example, when I have a taxonomy called "fruit" and I click on a fruit term called "lemons", How do I display both "lemons" and "fruit" on the taxonomy term page?

Just looking for the get term equivalent. Thx!

like image 613
James Avatar asked Jul 31 '10 03:07

James


People also ask

How do I find my taxonomy ID in WordPress?

You may get the term name from term_id like this: $term_name = get_term( $term_id )->name; Explanation: get_term() returns the term object and name is one of propeties of this object. $field => Just write 'id' here. $value => Place your 'term_id' value here. $taxonomy => write your custom taxonomy 'slug' here.

How do you find taxonomy?

To find the taxonomy code that most closely describes your provider type, classification, or specialization, use the National Uniform Claim Committee (NUCC) code set list. Note: You may select more than one code or code description when applying for an NPI, but you must indicate one of them as the primary code..

How do I find the taxonomic category of a WordPress image?

Go to your WP-admin ->Settings ->Taxonomy Image displayed in the taxonomies list form where you can select the taxonomies you want to include it in WP Custom Taxonomy Image. Go to your WP-admin select any category/term ,here image text box where you can manage image for that category/term.


2 Answers

A possible solution:

$taxonomy = get_queried_object();
echo  $taxonomy->name;
like image 197
Kiran Raj Pradhan Avatar answered Oct 04 '22 07:10

Kiran Raj Pradhan


For my taste is overly complicated, but here it goes:

$term = get_term_by('slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
echo $term->name;
like image 33
chodorowicz Avatar answered Oct 04 '22 08:10

chodorowicz