wordpress, display all child categories

[php]

echo’ <table border="0"><tr><td>’;
$counter=Display_catogories($t_parent," ",0,0);
echo’ </td></tr></table>’;

echo $t_content;
$counter=0;
function Display_catogories($t_parent,$title,$level){
global $counter;
$t_numer=1;
//echo $t_parent.’ ‘;
$args = array(
‘orderby’ => ‘name’,
‘hierarchical’ => ‘1’,
‘show_count’=>1,
‘child_of’ =>$t_parent
);
$categories = get_categories( $args );
foreach ( $categories as $category ) {
if($category->parent==$t_parent){
$counter++;
echo $title.$t_numer.’ <a href="’ . get_category_link( $category->term_id ) . ‘">’. $category->name .'(‘.$category->count.’)</a><br>’;

if(($counter%18)==0){ echo’ </td><td>’; }
Display_catogories($category->cat_ID,"..".$title.$t_numer."-",$level++);
$t_numer++;

}
}

$categories =NULL;
return $counter;
}

[/php]

Screen Shot 2013-07-27 at 8.54.49 AM


Comments

Leave a Reply