WordPress.org

Ready to get started?Download WordPress

Forums

Taxonomy title output (7 posts)

  1. claxixx
    Member
    Posted 3 years ago #

    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! :/

  2. Michael Fields
    Themer
    Posted 3 years ago #

    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

  3. petit-nono
    Member
    Posted 3 years ago #

    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

  4. Michael Fields
    Themer
    Posted 3 years ago #

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

    http://wordpress.org/extend/plugins/taxonomy-list-shortcode/

  5. petit-nono
    Member
    Posted 3 years ago #

    Thanks a lot for this update !

  6. slambert
    Member
    Posted 3 years ago #

    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; ?>

  7. magaworks
    Member
    Posted 3 years ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags