Skip to content

Instantly share code, notes, and snippets.

@TheHeat
Created January 19, 2013 15:20
Show Gist options
  • Save TheHeat/4573126 to your computer and use it in GitHub Desktop.
Save TheHeat/4573126 to your computer and use it in GitHub Desktop.
In Wordpress, if more than a single term exists within a given taxonomy, display the terms as links to their archives.
<?php $terms = get_terms("taxonomy_name");
$count = count($terms);
if ( $count > 1 ): foreach ( $terms as $term ): ?>
<a href="<?php echo get_bloginfo('url') . '/taxonomy_slug/' . $term->slug ?>"><?php echo $term->name ?></a>
<?php endforeach; endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment