I wish to display only first level of subcategories on current category page (if any).
I tried this code:
<?php
$args=array(
'child_of' => $cat-id,
'hide_empty' => 0,
'orderby' => 'name',
'order' => 'ASC',
'depth' => '1' //NOT WORKING
);
$categories=get_categories($args);
foreach($categories as $category) {
echo '<a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'</a>'; }
?>
But, it shows all children, and children's children (grandchildren). I tried with "'depth' => '1'" but it is ignored.
How to show only first level of children (if exist) on category page?