• 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 something similar for if the user is viewing a taxonomy page?

    is_taxonomy() doesn’t exist so i’m suck! :/

Viewing 6 replies - 1 through 6 (of 6 total)
  • This should steer you in the right direction:

    if( is_tax() ) {
        global $wp_query;
        $term = $wp_query->get_queried_object();
        $title = $term->name;
    }

    The following properties will be available for the $term object:

    term_id
    name
    slug
    term_group
    term_taxonomy_id
    taxonomy
    description
    parent
    count

    Hello,

    I got too many taxonomies to display, and it results as a very long scrolling to get the bottom of the page. So I would like to paginate the list, as it could separate the list every 50 words for example.

    May you give me the way to get this please ?

    Thanks a lot for your attention.

    Nono

    You will want to look at my Taxonomy Shortcode plugin version 0.8 where term paging is supported:

    https://www.ads-software.com/extend/plugins/taxonomy-list-shortcode/

    Thanks a lot for this update !

    I’ve been using this (which I found in the Hybrid Theme) and it works

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

    slambert -> Just wanted to thank for that code. I have been twisting my head trying to show term name for Taxonomy archive page and this worked perfectly. Thanks a lot

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Taxonomy title output’ is closed to new replies.