From 48b96208e28f0bde4ccb28e9f424353961f5234a Mon Sep 17 00:00:00 2001 From: ryan Date: Wed, 12 Sep 2007 02:53:27 +0000 Subject: [PATCH] Add echo or return option to wp_list_categories. Props Otto42. fixes #4182 git-svn-id: http://svn.automattic.com/wordpress/trunk@6091 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/category-template.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/wp-includes/category-template.php b/wp-includes/category-template.php index 02b7be5cc..0aee639b5 100644 --- a/wp-includes/category-template.php +++ b/wp-includes/category-template.php @@ -241,7 +241,8 @@ function wp_list_categories($args = '') { 'hide_empty' => 1, 'use_desc_for_title' => 1, 'child_of' => 0, 'feed' => '', 'feed_image' => '', 'exclude' => '', - 'hierarchical' => true, 'title_li' => __('Categories') + 'hierarchical' => true, 'title_li' => __('Categories'), + 'echo' => 1 ); $r = wp_parse_args( $args, $defaults ); @@ -290,7 +291,12 @@ function wp_list_categories($args = '') { if ( $title_li && 'list' == $style ) $output .= ''; - echo apply_filters('wp_list_categories', $output); + $output = apply_filters('wp_list_categories', $output); + + if ( $echo ) + echo $output; + else + return $output; } function wp_tag_cloud( $args = '' ) {