Created
December 10, 2011 23:03
-
-
Save davemac/1456920 to your computer and use it in GitHub Desktop.
Wordpress display the current category's parent, and link to it
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
<?php | |
$cat = get_the_category(); | |
$parentCatName = get_cat_name($cat[0]->parent); | |
$parentCatLink = get_category_link($cat[0]->parent); | |
echo '<a href="'.$parentCatLink.'">'.$parentCatName.'</a>'; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment