Hi guys,
really how do you do this?!?
Let me explain a bit better my issue here, on my WP installation I've got several categories (300+ categories inside of my database) and I was trying to give to each one of them a proper RSS Feed.
Basically the structure of my categories is as follow:
Now I've read on the help of FeedBurner, and it says that I shall create a new feed for each category. So I am sure now you can see my problem, I do noto want to create a single RSS Feed for each of my category, so I've created an RSS Feed for each parent category and now comes my problem.Code:parent category child category child category grandchild category child category parent category child category grandchild category child category ... and so on
I would like to display a link to the parent category for each children and grandchild categories so to find out the ancestor of the whole category system and I came up with this solution:
As you can see this is a simple function that's supposed to run until the value of the category parent is set to 0; in this case the current category is a parent category!Code:function parentCat( $cat ){ $result; if( $cat->parent == 0 ){ $result = $cat; } else{ $result = get_term_by('id', $cat->parent, 'ad_cat'); parentCat( $result ); } return $result; } //Variable to get the term object of the category $term = get_term_by('id', 'category_id', 'taxonomy_name'); $test = parentCat( $term );
But instead to run the function untill it finds out the straight parent of the category, that in some cases is not the category with a parent value set at 0...
Does anyone have an idea of how to find the anchestor category???
Thanks in advance for the help!!


LinkBack URL
About LinkBacks
Reply With Quote




