summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--wp-includes/category-template.php8
-rw-r--r--wp-includes/classes.php7
2 files changed, 11 insertions, 4 deletions
diff --git a/wp-includes/category-template.php b/wp-includes/category-template.php
index 3c7d10e..359f04a 100644
--- a/wp-includes/category-template.php
+++ b/wp-includes/category-template.php
@@ -31,6 +31,9 @@ function get_category_link($category_id) {
$category = &get_category($category_id);
$category_nicename = $category->category_nicename;
+ if ( $category->category_parent == $category_id ) // recursive recursion
+ $category->category_parent = 0;
+
if ( $parent = $category->category_parent )
$category_nicename = get_category_parents($parent, false, '/', true) . $category_nicename . '/';
@@ -238,7 +241,10 @@ function wp_list_categories($args = '') {
$output .= __("No categories");
} else {
global $wp_query;
- $r['current_category'] = $wp_query->get_queried_object_id();
+
+ if ( is_category() )
+ $r['current_category'] = $wp_query->get_queried_object_id();
+
if ( $hierarchical )
$depth = 0; // Walk the full depth.
else
diff --git a/wp-includes/classes.php b/wp-includes/classes.php
index f60b50d..f8bb896 100644
--- a/wp-includes/classes.php
+++ b/wp-includes/classes.php
@@ -616,13 +616,14 @@ class Walker_Category extends Walker {
$link .= ' ' . gmdate('Y-m-d', $category->last_update_timestamp);
}
- $_current_category = get_category( $current_category );
+ if ( $current_category )
+ $_current_category = get_category( $current_category );
if ( 'list' == $args['style'] ) {
$output .= "\t<li";
- if ( ($category->cat_ID == $current_category) && is_category() )
+ if ( $current_category && ($category->cat_ID == $current_category) )
$output .= ' class="current-cat"';
- elseif ( ($category->cat_ID == $_current_category->category_parent) && is_category() )
+ elseif ( $_current_category && ($category->cat_ID == $_current_category->category_parent) )
$output .= ' class="current-cat-parent"';
$output .= ">$link\n";
} else {