Question

I have a series of posts that all reside within a 'Main' parent category. A lot of posts that are in few different categories. Various posts are assigned to sub-categories.

What I need to do is display the direct parent category for the currently viewed post, without showing other categories. Here is what I have:

-MainCat

-subcat1

-post a
-post b

-subcat2

-post c
-post d

-post e

-subcat3

-post f

-post g

When viewing, for example, post 'a', I need to display subcat1 posts ONLY - not all the posts in the MainCat.

I need to display ONLY the current category. Even if the post is in 2 or more categories.

Example: www.website.com/apples/second/article.html www.website.com/oranges/second/article.html

I only need the last category(second) and the posts in it. Everythign I try gives me all the posts from the main parent category(apples or oranges).

Any help is appreciated.

No correct solution

OTHER TIPS

try this:

 get_categories(array('parent' => "post category ID", 'orderby' => 'order', 'hide_empty' => 0));
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top