Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <p>111</p>
- <?php
- $taxonomy = 'program';
- // get the term IDs assigned to post.
- $post_terms = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'ids' ) );
- // separator between links
- $separator = ', ';
- if ( !empty( $post_terms ) && !is_wp_error( $post_terms ) ) {
- $term_ids = implode( ',' , $post_terms );
- $terms = wp_list_categories( 'title_li=&style=none&echo=0&taxonomy=' . $taxonomy . '&include=' . $term_ids );
- $terms = rtrim( trim( str_replace( '<br />', $separator, $terms ) ), $separator );
- // display post categories
- echo $terms;
- }
- ?>
- <p>222</p>
- <?php
- //list terms in a given taxonomy using wp_list_categories (also useful as a widget if using a PHP Code plugin)
- $taxonomy = 'program';
- $orderby = 'name';
- $show_count = 0; // 1 for yes, 0 for no
- $pad_counts = 0; // 1 for yes, 0 for no
- $hierarchical = 1; // 1 for yes, 0 for no
- $title = '';
- $args = array(
- 'taxonomy' => $taxonomy,
- 'orderby' => $orderby,
- 'show_count' => $show_count,
- 'pad_counts' => $pad_counts,
- 'hierarchical' => $hierarchical,
- 'title_li' => $title
- );
- ?>
- <ul>
- <?php wp_list_categories( $args ); ?>
- </ul>
- <p>333</p>
- <?php echo get_the_term_list( $post->ID, 'program', '', ', ', '' ); ?>
- <p>444</p>
- <?php the_terms( $post->ID, 'program', 'Program: ', ' / ' ); ?>
- <p>555</p>
- <?php echo '<p>';
- echo get_the_term_list( $post->ID, 'program', ' ', ' · ', ' ' );
- echo '</p>'; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement