I'm trying to display a post category, I have two categories with two different parents.
I want to show only one of the category according to the parent category. This is the code that I am using at the moment to get the posts category.
$categories = get_the_category();
echo '<span class="parentCat">more from ';
foreach ( $categories as $category ) {
echo '<a href="/#'. $category->slug .'"><strong>' .$category->cat_name. '</strong></a>';
}
echo '</span>';
Thank you very much