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 linked post titles
- *
- ******************************************************************/
- if($cat == '') :
- 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 = '<span class="description">' . get_category($cat)->category_description . '</span>'; echo "\n"; }
- else { $desc = '<span class="description">no description available</span>'; }
- echo '<ul><li><a href="' . get_category_link($cat->term_id) . '">' . $cat->name . ' ' . $desc . '</a></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