WordPress.org

Ready to get started?Download WordPress

Forums

equivalent of single_cat_title() for custom taxonomy archive page (5 posts)

  1. kbiglione
    Member
    Posted 4 years ago #

    Trying to determine the best way to display a custom taxonomy term in a header for a custom taxonomy archive page.

    Is there an equivalent of single_cat_title() for custom taxonomies?

  2. paperpariah
    Member
    Posted 3 years ago #

    I would love to know this also

  3. paperpariah
    Member
    Posted 3 years ago #

    Found it!

    echo get_query_var( 'term' );

    worked for me :) :)

  4. kbiglione
    Member
    Posted 3 years ago #

    I ended up with a different solution.

    At the top of my template I included:
    <?php
    $termname = $wp_query->queried_object->name;
    $termdesc = $wp_query->queried_object->description;
    ?>

    Then displayed those variables later in the template.

    Your way seems easier.

  5. ethanoringel
    Member
    Posted 3 years ago #

    Thanks paperpariah and kbiglione. Both methods worked for me, but the get_query_var method was outputting the term title in lowercase so I went with kbiglione's method, putting that code at the top of my template then <?php echo $termname ?> wherever I wanted the term to appear. Works great. Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags