List Taxonomies Terms

March 14th, 2015 by
<?php $args = array( 'hide_empty=0' );

$terms = get_terms( 'TAXONOMY NAME HERE', $args );
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ) {
    $count = count( $terms );
    $i = 0;
    $term_list = '<p class="my_term-archive">';
    foreach ( $terms as $term ) {
        $i++;
    	$term_list .= '<a href="' . get_term_link( $term ) . '" title="' . sprintf( __( 'View all post filed under %s', 'my_localization_domain' ), $term->name ) . '">' . $term->name . '</a>';
    	if ( $count != $i ) {
            $term_list .= ' </br> ';
        }
        else {
            $term_list .= '</p>';
        }
    }
    echo $term_list;
}
		
			 ?>

Post a Comment

You must be logged in to post a comment.

Cached at: 2024-03-28 07:04:05pm