WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How to display hierarchy custom terms INLINE (not as a list) (1 post)

  1. Pete
    Member
    Posted 7 months ago #

    I have a choice of 2 different pieces of code to display my custom terms (in the custom taxonomy 'code')as a hierarchical list (both codes pretty much do the same thing)

    First one:
    <?php $taxonomy = 'code'; $terms = wp_get_post_terms( $post->ID, $taxonomy, array( "fields" => "ids" ) ); if( $terms ) {echo '<p">';$terms = trim( implode( ',', (array) $terms ), ' ,' ); wp_list_categories( 'style=none&title_li=&taxonomy=' . $taxonomy . '&include=' . $terms ); echo '</p>';} ?>

    Second one:
    <?php $taxonomy = 'code'; $orderby = 'name'; $style = 'list'; $show_count = 0; $pad_counts = 0; $hierarchical = 1; $title= ''; $args = array('taxonomy' => $taxonomy, 'orderby' => $orderby, 'show_count' => $show_count, 'pad_counts' => $pad_counts, 'hierarchical' => $hierarchical, 'title_li' => $title); ?><?php wp_list_categories( $args ); ?>

    Both do a great job in displaying them in list format... but I want them comma separated inline.

    style => none<code>or the css</code>style="display:inline;
    does work either :(

    Thanks heaps
    Pete

Reply

You must log in to post.

About this Topic