Last active
April 17, 2019 10:31
-
-
Save kisildev/b4d36f943822c336af98c198b25c3827 to your computer and use it in GitHub Desktop.
Get Term name of current page. Get Parent Term name of current page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Curent Term | |
<?php $term = get_term_by( 'slug', get_query_var('term'), get_query_var('taxonomy') ); | |
echo $term->name; ?> | |
//Curent + Parent term | |
<?php $term = get_term_by( 'slug', get_query_var('term'), get_query_var('taxonomy') ); | |
$parent_term = get_term( $term->parent, get_query_var('taxonomy') ); | |
echo $parent_term->name.' : '.$term->name; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment