list categories and subcategories with descriptions in nested list
-
I am trying to use get_categories to display a hierarchical list of categories and descriptions. Instead of diplaying subcategories in a nested list under the parent, I get one long list. Here is my code:
<ul> <?php $categories = get_categories('title_li=&hide_empty=0&parent=31'); foreach ($categories as $category) { echo "<li><a href=\"" . get_category_link( $cat->term_id ) . "\">" . $cat->cat_name . "<div class=\"description\">". $cat->description ."</div></a></li>"; } ?> </ul>
I’m not a php programmer, so I’m not sure how to modify this to show hierarchy. Any help would be great.
Viewing 13 replies - 1 through 13 (of 13 total)
Viewing 13 replies - 1 through 13 (of 13 total)
- The topic ‘list categories and subcategories with descriptions in nested list’ is closed to new replies.