[wp-hackers] patch for list_cats
Adi Jörg Sieker
ml at adsworth.info
Sat Jan 29 15:08:16 GMT 2005
and here is the patch. :))
Adi Jörg Sieker wrote:
> Hi,
>
> after reading this question
> http://wordpress.org/support/topic.php?id=21226 and playing around
> with wp_list_cats. I found that this isn't 100% possible because when
> you call wp_list_cats("children=0&child_of=3"); I would have expected
> the children of cat 3 to appear but not the children of the children. In
> the current implementation of list_cats nothing gets displayed. The
> attached patch allows list_cats to only display the direct decentants of
> the parent cat.
>
> Regards
> Adi
> _______________________________________________
> hackers mailing list
> hackers at wordpress.org
> http://wordpress.org/mailman/listinfo/hackers
>
-------------- next part --------------
Index: template-functions-category.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-includes/template-functions-category.php,v
retrieving revision 1.49
diff -U3 -r1.49 template-functions-category.php
--- template-functions-category.php 26 Jan 2005 22:49:18 -0000 1.49
+++ template-functions-category.php 29 Jan 2005 11:04:11 -0000
@@ -322,7 +322,7 @@
$thelist = "";
foreach ($categories as $category) {
- if ((intval($hide_empty) == 0 || isset($category_posts["$category->cat_ID"])) && (!$hierarchical || $category->category_parent == $child_of) && ($children || $category->category_parent == 0)) {
+ if ((intval($hide_empty) == 0 || isset($category_posts["$category->cat_ID"])) && (!$hierarchical || $category->category_parent == $child_of) ) {
$num_found++;
$link = '<a href="'.get_category_link(0, $category->cat_ID, $category->category_nicename).'" ';
if ($use_desc_for_title == 0 || empty($category->category_description)) {
More information about the hackers
mailing list