tags:

views:

20

answers:

1

Hello guys

Based on the example on http://codex.wordpress.org/Function_Reference/get_categories, I try to run get_categories function on wordpress. But the result show nothing. Is it because of the new version wordpress 3.0?

<?php 
$categories=  get_categories('child_of=10'); 
  foreach ($categories as $category) {
    $option = '<option value="/category/archives/'.$category->category_nicename.'">';
    $option .= $category->cat_name;
    $option .= ' ('.$category->category_count.')';
    $option .= '</option>';
echo $option;
}
?>

Need help on this one.

Thanks.

A: 

I am using the same data on my local as the one on www.sepakpojok.com. From the parent categories "soccer" I am trying to get its subcategories

Are you sure that the category 'soccer' has the same ID on both servers (local and production)?

If you've manually added the categories on each, rather than copying the DB from one to the other, the ID's for the same cat could be different.

In other words, are you sure the 'soccer' category ID is 10?

TheDeadMedic
I have found the reason to the problem. Since I save the data through back door, I ignore wp_term_taxonomy of "count". After I update it, the function work.Anyway thanks.
Willy