anurag-singh
8/21/2015 - 12:55 PM

Display custom taxonomy 'name' and 'description'

<?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; 

} ?>