How to display only parent category (without child categories) on a post loop?
I have:
<span class="entry-category"><?php the_category(', '); ?></span>
What should I do?
How to display only parent category (without child categories) on a post loop?
I have:
<span class="entry-category"><?php the_category(', '); ?></span>
What should I do?
You must be logged in to post a comment.
You can get category and check
parent
field for each entry like;