WordPress.org

Make WordPress Core

Changeset 1412


Ignore:
Timestamp:
06/11/04 19:01:01 (11 years ago)
Author:
jverber
Message:

Changed (wp_)list_cats. children argument now determines if categories below top level are displayed, and hierarchical determines if the list is displayed hierarchically.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/template-functions-category.php

    r1389 r1412  
    272272    if (!isset($r['feed_image'])) $r['feed_image'] = ''; 
    273273    if (!isset($r['exclude'])) $r['exclude'] = ''; 
    274  
    275     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']); 
    276 } 
    277  
    278 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 = '') { 
     274    if (!isset($r['hierarchical'])) $r['hierarchical'] = true; 
     275 
     276    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']); 
     277} 
     278 
     279function 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) { 
    279280    global $wpdb, $category_posts; 
    280281    global $querystring_start, $querystring_equal, $querystring_separator; 
     
    350351     
    351352    foreach ($categories as $category) { 
    352         if ((intval($hide_empty) == 0 || isset($category_posts["$category->cat_ID"])) && (!$children || $category->category_parent == $child_of)) { 
     353        if ((intval($hide_empty) == 0 || isset($category_posts["$category->cat_ID"])) && (!$hierarchical || $category->category_parent == $child_of) && ($children || $category->category_parent == 0)) { 
    353354            $num_found++; 
    354355            $link = '<a href="'.get_category_link(0, $category->cat_ID, $category->category_nicename).'" '; 
     
    404405                $thelist .= "\t$link<br />\n"; 
    405406            } 
    406             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); 
     407            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); 
    407408            if ($list) $thelist .= "</li>\n"; 
    408409            } 
Note: See TracChangeset for help on using the changeset viewer.