creativelifeform
Member
Posted 4 months ago #
Hi,
just not understanding what's going on with this function. I have a post which is in multiple categories. I have a category structure like this:
cat1
-cat1A
--cat1A1
-cat1B
--cat1B1
And let's say my post belongs to BOTH cat1A1 and cat1B1. Now if I use the_category(); without any parameters, it will return exactly what I want which is a ul containing links to cat1A and cat1B. However, as soon as I use any parameters, this does not happen. I either see cat1A ONLY or I see the entire parent tree. Can anybody let me know why this might happen?
creativelifeform
Member
Posted 4 months ago #
The problem seems to happen when using a separator. If I call the function like this:
<?php the_category('','multiple',$post->ID);?>
The result is normal (but no separator). If I do this:
<?php the_category(' ','multiple',$post->ID);?>
I get only one category listed.
creativelifeform
Member
Posted 4 months ago #
Hmm I've solved it like this
$category = get_the_category();
foreach($category as $cat)
{
echo '<a href="'.get_category_link($cat->term_id ).'">'.$cat->cat_name.'</a> ';
}
Not sure what was happening with the other function but there it is.