cyxmedia
9/8/2017 - 6:56 PM

Mostrar términos de una taxonomía para el item activo (WP)

Pedazo de código para mostrar todos los términos de una taxonomía para el item activo

<?php   // Get terms for post
 $terms = get_the_terms( $post->ID , 'empresa' );
 // Loop over each item since it's an array
 if ( $terms != null ){
 foreach( $terms as $term ) {
 // Print the name method from $term which is an OBJECT
 print $term->name ;
 // Get rid of the other data stored in the object, since it's not needed
 unset($term);
} } ?>

<!-- Para mostrar el slug debemos cambiar tan sólo print $term->name por print $term->slug  -->