• Resolved Pete

    (@perthmetro)


    I’m not sure but… it appears the latest update 3.7/3.8 has changed how this piece of code works (I’m sure it worked fine in 3.6x). As the title of the posts say… I want to display the custom hierarchical taxonomy as per it’s hierarchical structure/format in bullet form.

    This is the code…

    <ul><?php
        $taxonomy = 'program';
        $post_terms = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'ids' ) );
        $separator = ' ? ';
        if ( !empty( $post_terms ) && !is_wp_error( $post_terms ) ) {
                $term_ids = implode( ',' , $post_terms );
                $terms = wp_list_categories( 'title_li=&echo=0&taxonomy=' . $taxonomy . '&include=' . $term_ids  );
                $terms = rtrim( trim( str_replace( '<br />',  $separator, $terms ) ), $separator );
                echo  $terms;
        }
        ?></ul>

    This is what I would like the code to display…

    • Parent taxonomy
    • Child taxonomy
    • Grandchild taxonomy 1
    • Grandchild taxonomy 2

    Unfortunately this is wha he code displays…

    • Child taxonomy
    • Grandchild taxonomy 1
    • Grandchild taxonomy 2
    • Parent taxonomy

    Any help greatly appreciated!

    Regards, Pete

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Display custom hierarchical taxonomies in hierarchical bullet format’ is closed to new replies.