posts - How do I retrieve then print the currently viewed sub categories?

admin2025-06-05  0

I am building a 'course-like' WP site, without the use of any particular 'course plugins' and for this, I need to be able to show all the sub-categories in the sidebar for that particular course.

Example: I have a course about cooking. Here are the Categories (parents in bold) and sub-categories (along with posts in Italics)...

A Food Course (Parent) Preparing food (SubCat) - Washing hands - Hair nets - What tools to use Using Ingredients (SubCat) - Storage - Use-by Dates

So, if the user is on a post page (say Hair Nets), then in the sidebar, I need to display the menu structure for that particular Parent Category, so they can skip to other sections just in that course, quickly.

I know, to generate the menu I would need to get/retrieve the parent category of the current post, can anyone shed any light?

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1749126777a316591.html

最新回复(0)