How to display singular_name of custom taxonomy?

by Piotr Milecki   Last Updated June 12, 2019 20:08 PM

I'm displaying list of term from each taxonomy assigned to custom post:

<?php $taxonomies = get_object_taxonomies( $post );
foreach ( $taxonomies as $taxonomy ) {

the_terms( $post->ID, $taxonomy, '<span class="e-article__category__item"><strong>' . SINGULAR_NAME . ': </strong>  ', ", ", '</span>' );
} ?>

but here, in SINGULAR_NAME I would like to display the singular_name of CPT.

I was trying this:

<?php $taxonomies = get_object_taxonomies( $post );
foreach ( $taxonomies as $taxonomy ) {

$term_name = $taxonomy->labels->singular_name;

the_terms( $post->ID, $taxonomy, '<span class="e-article__category__item"><strong>' . $term_name . ': </strong>  ', ", ", '</span>' );
} ?>

but with no effects. How to do that correctly?

Thanks :)



Related Questions


Updated January 03, 2018 21:08 PM

Updated August 13, 2016 08:03 AM

Updated April 13, 2017 17:08 PM

Updated September 28, 2017 20:08 PM

Updated September 06, 2017 18:08 PM