Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Sep 10th, 2010  |  syntax: PHP  |  size: 0.93 KB  |  views: 174  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. function displayCategories() {
  2.  
  3.         //$cats = wp_list_categories('hierarhical=0&depth=1&echo=0'); <- this dont work 100% good
  4.         $cats = get_categories('hierarhical=1&parent=0'); <- returns an array object
  5.         $count = 0;
  6.         //echo '<pre>';print_r($cats);echo '</pre>';
  7.        
  8.         foreach ($cats as $categories) {
  9.                 $count = $count + 1;
  10.        
  11.                 if($count == 4 || $count == 7 || $count == 10 || $count == 13 || $count == 16 || $count == 19)
  12.                         {
  13.                                 echo '<div class="clear"></div>';
  14.                         }
  15.                
  16.                 echo "<div class=\"categoryItem";
  17.                                 if($count == 2 || $count == 5 || $count == 8 || $count == 11 || $count == 14 || $count == 17) { echo " space"; }
  18.                 echo "\">\n";
  19.                         //get_category_link() -> this get the link of the category
  20.                         echo "<a href=\"".get_category_link($categories->cat_ID)."\" title=\"$categories->name\">$categories->name</a>\n";
  21.                         echo "<p>$categories->description</p>\n";
  22.                 echo "</div>";                 
  23.         }
  24.        
  25.         echo "<div class=\"clear\"></div>";
  26.        
  27. }
clone this paste RAW Paste Data