WordPress.org

Ready to get started?Download WordPress

Forums

Echoing Hierarchical Custom Taxonomies for Custom Post Types (6 posts)

  1. djquinn
    Member
    Posted 4 years ago #

    Suppose you have a custom post type with an hierarchical custom taxonomy registered to it. How do we go about echoing children in the taxonomy, as opposed to every term in the taxonomy (or parents, for that matter)? Last I tried, the only function that would return the terms is get_the_term_list, as the normal categories functions only work with default Posts. Will 3.0 have functions to work with custom hierarchical taxonomies?

  2. djquinn
    Member
    Posted 4 years ago #

  3. djquinn
    Member
    Posted 4 years ago #

    No ideas? Is it even possible yet?

  4. djquinn
    Member
    Posted 4 years ago #

    Guess not.

  5. MichaelH
    Member
    Posted 4 years ago #

    How about:

    <?php
    $taxonomy = 'genre';
    $tax_terms = get_terms($taxonomy);
      foreach ($tax_terms as $tax_term) {
      if ($tax_term->parent) {
        echo '<p>'.$tax_term->name . ' is a child term </p>';
      }
    }
    ?>
  6. djquinn
    Member
    Posted 4 years ago #

    Wow, thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic