Advertisement
Guest User

hierarchical link categories

a guest
Jun 23rd, 2011
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.43 KB | None | 0 0
  1. <?php
  2. $linkCats = get_terms('link_category');
  3. $i = 1;
  4. $catsToList;
  5.  
  6. foreach ($linkCats as $linkCat) {
  7.     if ($linkCat->parent == 5) {
  8.         if ($i > 1) {
  9.             $catsToList .= ", ";
  10.         }
  11.         $catsToList .= $linkCat->term_id;
  12.         $i++;
  13.     }
  14. }
  15.  
  16. $topLevelCatList = array(
  17.     'category' => 5,
  18. );
  19. wp_list_bookmarks($topLevelCatList);
  20.  
  21. if ($catsToList) {
  22.     $subCats = array(
  23.         'category' => $catsToList,
  24.     );
  25.     wp_list_bookmarks($subCats);
  26. }
  27. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement