[wp-hackers] Problem getting categories
Brian Fidler
fidler.brian at gmail.com
Mon May 10 17:33:46 UTC 2010
I'm working on an artists website where I have categories set up like this:
Paintings
-collection1
-collection2
Prints
-collection3
-collection4
Once I have the category I want to loop through all posts in that category
to grab a custom field from each post.
my url string looks like this:
http://www.mysite.com/paintings/collection1/post-name
http://www.mysite.com/prints/collection3/post-name
I'm trying to get the categories using this:
$categories = get_the_category($post->ID);
echo $categories[0]->cat_name;
It gets the parent category (category[0]) without any problem however it
isn't getting child categories at all.
What am I doing wrong?
thanks
brian
More information about the wp-hackers
mailing list