Wordpress Taxonomy title output

Carpy picture Carpy · May 10, 2010 · Viewed 14.9k times · Source

I'm trying to output the title of a taxonomy page when viewing it.

So like, if I was on a 'tag' page I would go:

<?php if (is_tag()) {?>
    <h1><?php single_cat_title(); ?></h1>
<?php } ?>

But how would I achieve the same thing for if the user is viewing a specific taxonomy page?

is_taxonomy() doesn't exist.

Answer

Carpy picture Carpy · May 10, 2010

Found this answer for anyone else wondering.

Follow this guide: http://justintadlock.com/archives/2009/06/04/using-custom-taxonomies-to-create-a-movie-database

Right down the bottom, the line wanted was:

<?php $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); echo $term->name; ?>