Display the category published in post type in wordpress

0

How do I display the category registered in a post type in Wordpress?

I'm using the Odin Framework, I created a post type called products and would like to display the category next to the post.

Ex: Posted on July 6, 2017 in the category Refrigerators.

In blog posts, to display the categories the following code is used:

<?php echo __( 'Posted in:', 'odin' ) . ' ' . get_the_category_list(); ?>

    
asked by anonymous 06.07.2016 / 13:51

1 answer

1

I'm not sure how your framework works, but using some WP functions you can do this in a number of ways:

$categoria = get_category(get_query_var('cat'))->name;

Ref:

$categoria = get_cat_name( $cat_id );

Ref:

Anything read on link , it is about a case similar to yours.

    
06.07.2016 / 14:37