Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function displayCategories() {
- //$cats = wp_list_categories('hierarhical=0&depth=1&echo=0'); <- this dont work 100% good
- $cats = get_categories('hierarhical=1&parent=0'); <- returns an array object
- $count = 0;
- //echo '<pre>';print_r($cats);echo '</pre>';
- foreach ($cats as $categories) {
- $count = $count + 1;
- if($count == 4 || $count == 7 || $count == 10 || $count == 13 || $count == 16 || $count == 19)
- {
- echo '<div class="clear"></div>';
- }
- echo "<div class=\"categoryItem";
- if($count == 2 || $count == 5 || $count == 8 || $count == 11 || $count == 14 || $count == 17) { echo " space"; }
- echo "\">\n";
- //get_category_link() -> this get the link of the category
- echo "<a href=\"".get_category_link($categories->cat_ID)."\" title=\"$categories->name\">$categories->name</a>\n";
- echo "<p>$categories->description</p>\n";
- echo "</div>";
- }
- echo "<div class=\"clear\"></div>";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement