wordpress, display all child categories

July 27, 2013   ·   0 Comments

Screen Shot 2013-07-27 at 8.54.49 AM

 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;
 }

Screen Shot 2013-07-27 at 8.54.49 AM

shareShare on FacebookShare on Google+Share on LinkedInEmail this to someonePrint this pageBuffer this pageDigg thisFlattr the authorShare on RedditPin on PinterestShare on StumbleUponShare on TumblrTweet about this on Twitter

By


Readers Comments (0)


You must be logged in to post a comment.

PowenKo’s Online Store

powenko_arduinoBook
Wordpress99

Wordpress

Amazon

adsbygoogle

Recent Posts

Categories

Amazon