Created
May 12, 2015 15:08
-
-
Save jymartineau/dc7be3f37d184e9216f2 to your computer and use it in GitHub Desktop.
Get taxonomy for Custom Post Type - Wordpress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$args = array( 'hide_empty=0' ); | |
$terms = get_terms( 'category', $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 .= ' · '; | |
} | |
else { | |
$term_list .= '</p>'; | |
} | |
} | |
echo $term_list; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment