Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save developer-anuragsingh/b01998c45a59760a69b1 to your computer and use it in GitHub Desktop.
Save developer-anuragsingh/b01998c45a59760a69b1 to your computer and use it in GitHub Desktop.
<?php
//Get the custom taxonomy term 'name' and 'description'
$taxonomy = 'YOUR_CUSTOM_TAXO_NAME';
$terms = wp_get_object_terms( $post->ID, $taxonomy, array('orderby'=>'term_order') );
if ( !empty( $terms ) && !is_wp_error( $terms ) ) {
$taxoID = $terms[1]->term_id;
#var_dump($terms);
$customTaxoName = $terms[1]->name;
$customTaxoDescription = term_description( $taxoID, 'YOUR_CUSTOM_TAXO_NAME' );
if($customTaxoDescription != '') :
echo '<h2>'.$customTaxoName.'</h2>';
echo '<p>'.$customTaxoDescription.'</p>';
endif;
} ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment