Show categories nested by default. New wp_list_cats function that uses parse_str.

git-svn-id: http://svn.automattic.com/wordpress/trunk@873 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
saxmatt 2004-02-13 16:14:36 +00:00
parent a4ecbd3b9c
commit ecbf95566b
2 changed files with 21 additions and 2 deletions

View File

@ -72,7 +72,7 @@ require('wp-blog-header.php');
<?php get_links_list(); ?>
<li id="categories">Categories:
<ul>
<?php list_cats(0, 'All', 'name'); ?>
<?php wp_list_cats(); ?>
</ul>
</li>
<li id="search">Search:

View File

@ -236,7 +236,26 @@ function dropdown_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_
}
// out of the WordPress loop
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 = 0, $children=FALSE, $child_of=0, $categories=0, $recurse=0) {
function wp_list_cats($args = '') {
parse_str($args, $r);
if (!$r['optionall']) $r['optionall'] = 1;
if (!$r['all']) $r['all'] = 'All';
if (!$r['sort_column']) $r['sort_column'] = 'ID';
if (!$r['file']) $r['file'] = '';
if (!$r['list']) $r['list'] = true;
if (!$r['optiondates']) $r['optiondates'] = 0;
if (!$r['hide_empty']) $r['hide_empty'] = 1;
if (!$r['use_desc_for_title']) $r['use_desc_for_title'] = 1;
if (!$r['children']) $r['children'] = true;
if (!$r['child_of']) $r['child_of'] = 0;
if (!$r['categories']) $r['categories'] = 0;
if (!$r['recurse']) $r['recurse'] = 0;
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']);
}
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) {
global $tablecategories, $tableposts, $tablepost2cat, $wpdb;
global $pagenow, $siteurl, $blogfilename;
global $querystring_start, $querystring_equal, $querystring_separator;