lundi 30 mars 2015

How to print custom post type category name in a post/page

I have been googling a lot of time to find a solution to this. I am using dream themes' nimble wordpress theme. I want to print the "dt_portfolio" custom post type's category name in th portfolio page. I have tried many ways to do that. But no use. Finally I am stuck with this and used this code :



$ctname = get_the_terms( get_the_ID(), 'dt_portfolio_category' );
print_r ($ctname);


This gave me an output as below:



Array ( [27] => stdClass Object ( [term_id] => 27 [name] => Magazine [slug] => magazine [term_group] => 0 [term_taxonomy_id] => 33 [taxonomy] => dt_portfolio_category [description] => [parent] => 0 [count] => 3 [object_id] => 8560 [filter] => raw ) )


I want to print the "slug" from this array. Please help me to do that.


Aucun commentaire:

Enregistrer un commentaire