Support » Fixing WordPress » Display taxonomy 2nd & 3rd level terms

  • Hello,

    I have a custom taxonomy called location. Under location I have arranged a structure like so:


    I would like to be able to output these terms in hierarchical order and be able to add my own links to these instead of these linking to the archive page of these terms.

    So far I have code to output the state which is allowing me to add my own href:

    								//display state
    echo '<ul class="location">';						$taxonomyName = "location";
    $terms = get_terms($taxonomyName,array('parent' => 0));
    								foreach($terms as $term) {
    echo '<li><a class="state" href="#">'.$term->name.'</a></li>';
    echo '</ul>';
    // end state

    How can i specifically grab only the second level term, or third level term?

    I realise this is a roundabout way, but using any of the commands like get_terms, _wp_list_categories, get_the_term_list etc…. they all output the taxonomy either not in order, or with their own links to the taxonomy which is not what I want.

    Would be great to hear some tips or pointers on the matter.



  • The topic ‘Display taxonomy 2nd & 3rd level terms’ is closed to new replies.