Skip to content

Instantly share code, notes, and snippets.

@eugenoprea
Created February 3, 2013 01:44
Show Gist options
  • Save eugenoprea/4700182 to your computer and use it in GitHub Desktop.
Save eugenoprea/4700182 to your computer and use it in GitHub Desktop.
Genesis - How to Display Custom Taxonomy Terms - Display Taxonomy Terms
// taxonomy terms will be displayed after the post content (notice the priority of 50)
add_action ('genesis_post_content', 'eo_display_taxonomy_terms', 50);
function eo_display_taxonomy_terms()
{
// replace with the slugs of your custom taxonomies
$taxonomy1 = 'taxonomy1';
$taxonomy2 = 'taxonomy2';
$other_taxonomies = array('taxonomy3', 'taxonomy4');
// display all terms from the first taxonomy separated by commas, with each term linking to that term's archive page
echo '<div class="taxonomy_first">Your first taxonomy: ' . eo_get_tax_terms($taxonomy1) . '</div>';
// display at most 3 terms from the second taxonomy separated by |, without links to term archive pages
echo '<div class="taxonomy_second">Your second taxonomy: ' . eo_get_tax_terms($taxonomy2, 3, false, ' | ') . '</div>';
// display at most 5 terms from the other taxonomies separated by commas, with links to term archive pages
echo '<div class="taxonomy_other">Other taxonomies: ' . eo_get_tax_terms($other_taxonomies, 5) . '</div>';
// ... and so on
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment