WordPress.org

Ready to get started?Download WordPress

Forums

Getting a custom taxonomy´s name outside the loop when it contains no posts (1 post)

  1. floflofloflo
    Member
    Posted 3 years ago #

    Hi, i built a custom taxonomy template (taxonomy-mytaxonomyname.php), and i want to display the name and description of the category outside the loop.

    i am using following:

    <?php
    echo get_the_term_list($post->ID,  'mytaxonomyname', '', ', ', ''); // category name
    category_description(); // description
     ?>

    This works fine when posts are available, however, when the category contains no posts (which will happen), only the description is shown (since "get_the_term_list" depends on post id).

    how do i display the custom taxonomys name when no posts are available?

    thanks a lot!

Topic Closed

This topic has been closed to new replies.

About this Topic