I'm having the hardest time figuring this out:
I want to list the parent category of a grandchild without listing its grandfather. I'm using this code to list parents:
<?php $category = $wp_query->get_queried_object();
$parent = ($category->category_parent) ? $category->category_parent : $cat;
echo get_category_parents($parent, TRUE, ' » ', FALSE );
?>
I really have no need for those rackquotes as I only want to list the most immediate parent, and not go further up the chain!
I was also messing around with this code, but the output of the $parent variable is an unlinked number, rather than a linked nicename. echo $parent->category_nicename; isn't working:
<?php
$cat_object = $wp_query->get_queried_object();
$parentcat = ($cat_object->category_parent) ? $cat_object->category_parent : $cat;
echo $parentcat;
?>
Thanks in advance for any help!
-spinto