View difference between Paste ID: LWqMypag and
SHOW:
|
|
- or go back to the newest paste.
1 | - | |
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 | } |