From a6fba8edcf7c099efa21bcd6c7362687f9d588f7 Mon Sep 17 00:00:00 2001 From: Ryan Boren 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: https://develop.svn.wordpress.org/trunk@6091 602fd350-edb4-49c9-b593-d223f7449a82 --- 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 02b7be5cc6..0aee639b54 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 = '' ) {