Skip to content

Instantly share code, notes, and snippets.

@theodorocaliari
Last active December 23, 2015 20:19
Show Gist options
  • Save theodorocaliari/6688253 to your computer and use it in GitHub Desktop.
Save theodorocaliari/6688253 to your computer and use it in GitHub Desktop.
show custom taxonomy - http://stackoverflow.com/a/15505132 - reference
<?php
function mostra(){
//http://stackoverflow.com/a/15505132 - reference
global $post;
$taxonomies = get_object_taxonomies($post->post_type);
foreach ($taxonomies as $taxonomy) {
$terms = get_the_terms( $post->ID, $taxonomy );
if ( !empty( $terms ) ) {
foreach ( $terms as $term ){
$mostra = $term->name;
}
}
}
return $mostra;
}
$valor = mostra();
if($valor == 'Novo'): ?>
<span class="novo"></span>
<?php elseif($valor == 'Flex'): ?>
<span class="flex"></span>
<?php else: ?>
<?php endif;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment