admin管理员组

文章数量:1130349

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?

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?

本文标签: postsHow do I retrieve then print the currently viewed sub categories