Guest User

Untitled

a guest
Mar 14th, 2011
288
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php $categories=get_categories('order=DESC&hide_empty=0&hierarchical=0'); ?>
  2. <?php $parent = get_cat_name($category[0]->category_parent); ?>
  3.  
  4. <?php foreach($categories as $category) {
  5.  
  6.         if(!empty($parent)) :  
  7.        
  8.                 echo "<p>".$category->name."</p>";
  9.      
  10.             else :
  11.        
  12.                 echo "<p>".$category->name."</p>";
  13.                
  14.                 /* Loop Show Post Titles */            
  15.  
  16.             endif;
  17.        
  18.  
  19. } /* End of Foreach*/  ?>
  20.  
  21.  
  22. What I to do is something like this
  23.  
  24. Category 1
  25.     Child Category 1.1
  26.         Sub-Child Category 1.1.1
  27.             Post Title 1
  28.             Post Title 2
  29.             Post Title 3
  30.     Child Category 1.2
  31.         Sub-Child Category 1.1.1
  32.             Post Title 4
  33.             Post Title 5
  34.             Post Title 6
  35. Category 2
  36.     Child Category 2.1
  37.     Child Category 2.2
  38.     Child Category 2.3....
  39. Category 3
  40.     Child Category 3.1.....
RAW Paste Data