Displaying sub-category name issue with multiple categories
-
Hi,
I’ve been customizing WordPress to be used for my portfolio site and I came across with an issue.
I want to display the name of sub-category as a header for the category. I’m using the code below which was given by someone (much appreciated!)
<? $category = get_the_category(); echo $category[1]->cat_name; ?>
It works fine except that if there is any post which has more than one category assigned WordPress only displays the younger ID number’s category name. For example I have one post which is in “Illustration” (id=5) and “Painting” (id=8) under the parent category “Work” (id=2). If you go to the “Painting” category page the title header says “Illustration” and it won’t display “Painting”.
I looked around but I couldn’t find anyone who had the same issue. If anyone of you have had teh same problem and resolved it please let me know. Many thanks!
AD
Thanks!
- The topic ‘Displaying sub-category name issue with multiple categories’ is closed to new replies.