From 98603cefa59f7bec2e93367c2b10f25461699db2 Mon Sep 17 00:00:00 2001 From: jverber Date: Fri, 11 Jun 2004 19:01:01 +0000 Subject: [PATCH] Changed (wp_)list_cats. children argument now determines if categories below top level are displayed, and hierarchical determines if the list is displayed hierarchically. git-svn-id: http://svn.automattic.com/wordpress/trunk@1412 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/template-functions-category.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/wp-includes/template-functions-category.php b/wp-includes/template-functions-category.php index cfa7bfe64e..edce60d47b 100644 --- a/wp-includes/template-functions-category.php +++ b/wp-includes/template-functions-category.php @@ -271,11 +271,12 @@ function wp_list_cats($args = '') { if (!isset($r['feed'])) $r['feed'] = ''; if (!isset($r['feed_image'])) $r['feed_image'] = ''; if (!isset($r['exclude'])) $r['exclude'] = ''; + if (!isset($r['hierarchical'])) $r['hierarchical'] = true; - list_cats($r['optionall'], $r['all'], $r['sort_column'], $r['sort_order'], $r['file'], $r['list'], $r['optiondates'], $r['optioncount'], $r['hide_empty'], $r['use_desc_for_title'], $r['children'], $r['child_of'], $r['categories'], $r['recurse'], $r['feed'], $r['feed_image'], $r['exclude']); + list_cats($r['optionall'], $r['all'], $r['sort_column'], $r['sort_order'], $r['file'], $r['list'], $r['optiondates'], $r['optioncount'], $r['hide_empty'], $r['use_desc_for_title'], $r['children'], $r['child_of'], $r['categories'], $r['recurse'], $r['feed'], $r['feed_image'], $r['exclude'], $r['hierarchical']); } -function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0, $optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children=FALSE, $child_of=0, $categories=0, $recurse=0, $feed = '', $feed_image = '', $exclude = '') { +function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0, $optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children=FALSE, $child_of=0, $categories=0, $recurse=0, $feed = '', $feed_image = '', $exclude = '', $hierarchical=FALSE) { global $wpdb, $category_posts; global $querystring_start, $querystring_equal, $querystring_separator; // Optiondates now works @@ -349,7 +350,7 @@ function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_orde $thelist = ""; foreach ($categories as $category) { - if ((intval($hide_empty) == 0 || isset($category_posts["$category->cat_ID"])) && (!$children || $category->category_parent == $child_of)) { + if ((intval($hide_empty) == 0 || isset($category_posts["$category->cat_ID"])) && (!$hierarchical || $category->category_parent == $child_of) && ($children || $category->category_parent == 0)) { $num_found++; $link = 'category_description)) { @@ -403,7 +404,7 @@ function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_orde } else { $thelist .= "\t$link
\n"; } - if ($children) $thelist .= list_cats($optionall, $all, $sort_column, $sort_order, $file, $list, $optiondates, $optioncount, $hide_empty, $use_desc_for_title, $children, $category->cat_ID, $categories, 1, $feed, $feed_image, $exclude); + if ($hierarchical && $children) $thelist .= list_cats($optionall, $all, $sort_column, $sort_order, $file, $list, $optiondates, $optioncount, $hide_empty, $use_desc_for_title, $hierarchical, $category->cat_ID, $categories, 1, $feed, $feed_image, $exclude, $hierarchical); if ($list) $thelist .= "\n"; } }