I am using the get_categories() function combined with a foreach loop, to create a list of all the catgorys in a form. like so:
$args = array(
'type' => 'post',
'hide_empty' => 0, //<--IMPORTANT!!
'hierarchical' => 1,
'taxonomy' => 'category',
'pad_counts' => false );
$categories = get_categories($args);
foreach($categories as $category) {
echo '<tr>';
echo "<td>$category->name</td>";
echo "<td><input type='text' name='$category->cat_ID'/></td>";
echo '</tr>';
}
However, what I need is for all the sub categories to be indented, but I cannot work out how.
After looking at the documentation Here it seems that $category->parent parameter, may be helpful, but I cannot get it working.
Any help would be appreciated.