Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- process_cat_trees();
- function process_cat_trees( $cat='' ) {
- /*****************************************************************
- *
- * alchymyth 2011
- * transformationpowertools.com/wordpress
- * a hierarchical list of all categories, with descriptions
- *
- ******************************************************************/
- if($cat == '') :
- //add any parameter for get_categories() into the code in the next line//
- foreach( get_categories('hide_empty=false') as $category ) :
- if( !$cat->parent ) { $next[] = $category; }
- endforeach;
- else:
- $next = get_categories('hide_empty=false&parent=' . $cat);
- endif;
- if( $next ) :
- foreach( $next as $cat ) :
- if(get_category($cat)->category_description) {
- $desc = get_category($cat)->category_description; }
- else { $desc = 'no description available'; }
- echo '<ul><li><a href="' . get_category_link($cat->term_id) . '"><strong>' . $cat->name . '</strong></a><span><p>' . $desc . '</p></span></li>'; echo "\n";
- process_cat_trees( $cat->term_id );
- endforeach;
- endif;
- echo '</ul>'; echo "\n";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement