Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
//FOR POST
$t = wp_get_post_terms(get_the_id(),'taxonomy');
$t[0] = ($t[0]->parent && !$t[1]->parent) ? $t[0] : $t[1];
if($t[0]->parent)
{ $p = get_term_by('id',$t[0]->parent,'taxonomy');
echo '<a href="'.get_term_link($t[0]->parent,'taxonomy').'">'.$p->name.'</a> &raquo; '; }
echo '<a href="'.get_term_link($t[0]->term_id,'taxonomy').'" class="crumb-current">'.$t[0]->name.'</a>';
//FOR ARCHIVE
$t = get_term_by('id',$wp_query->queried_object_id,'taxonomy');
if($t->parent)
{ $p = get_term_by('id',$t->parent,'taxonomy');
echo '<a href="'.get_term_link($t->parent,'taxonomy').'">'.$p->name.'</a> '; }
echo '<a href="'.get_term_link($t->term_id,'taxonomy').'" class="crumb-current">'.$t->name.'</a>';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment