How to get the direct category of the post ?
-
Hi everybody,
I am creating a my wordpress theme. But i need some help to display category.In my theme i have categories, sub categories, pages and posts organized like this:
Cat1 ---post101 Cat2 --Sub cat21 ---post211 ---post212 --Sub cat22 ---post221 ---post222 Cat3 --Sub cat31 Cat4
I use following code in my index.php to retrieve categories of the current post :
<div class="categorieformat"> | Catégorie:<br/> <?php the_category(', ') ?> </div>
This code applied in post211 gives me sub cat21 and cat2.
I want just to have the subcategory of post211 and category of the post101. Just the category one level up.Thanks
- The topic ‘How to get the direct category of the post ?’ is closed to new replies.