Last active
August 29, 2015 14:06
-
-
Save croosen/6724f435ec978b02d1b6 to your computer and use it in GitHub Desktop.
WordPress - Show categories of custom post type on template file
This file contains hidden or 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 | |
$taxonomy = 'your_taxonomy_name'; | |
$terms = get_terms($taxonomy); // Get all terms of a taxonomy | |
if ( $terms && !is_wp_error( $terms ) ) : ?> | |
<ul> | |
<?php foreach ( $terms as $term ) { ?> | |
<li><a href="<?php echo get_term_link($term->slug, $taxonomy); ?>"><?php echo $term->name; ?></a></li> | |
<?php } ?> | |
</ul> | |
<?php endif;?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment