Skip to content

Instantly share code, notes, and snippets.

@taciara
Created March 6, 2019 15:17
Show Gist options
  • Save taciara/1d16e4cd462a7cff57fcaa90d3606e16 to your computer and use it in GitHub Desktop.
Save taciara/1d16e4cd462a7cff57fcaa90d3606e16 to your computer and use it in GitHub Desktop.
Dar echo em uma taxonomia dentro de uma página/single....
<?php // colocar isso após o if(have_posts()):the_post();
$termsAutor = get_the_terms( get_the_ID(), 'NOMEDATAXONOMIA' );
$autor = '';
if ( $termsAutor && ! is_wp_error( $termsAutor ) ) {
foreach ( $termsAutor as $term ) {
if ( 0 == $term->parent ) {
$autor = $term->name;
} else {}
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment