get parent taxonomy name in taxonomy page / template

Posted: September 9, 2015 in Uncategorized
Tags: ,

after creating taxonomy-tax_slug.php page , I want to add parent taxonomy name when sub taxonomy is being viewing

 

$term = $wp_query->queried_object;
$parent_id =  $term->parent;
if($parent_id!=0){
$parent_tax_arr = get_term_by(‘id’, $parent_id, ‘tax_slug’);
echo $parent_tax_arr->name.’->’;
}
printf( __( ‘%s’, ‘your_textdomain’ ), single_cat_title( ”, false ) );

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s