wp_list_categories() messes up the current category
|Reported by:||xtc62||Owned by:||anonymous|
I tried on my blog to list the latest 5 posts from some of my categories so I used a "second loop" like this:
and then the usual loop routine with
<?php while( have_posts() ) : the_post(); ?> ... <?php endwhile; ?>
After this I wanted to list all of my categories using the wp_list_categories() but found out that even if I was under category with ID=6(for example) the category with ID=5 was still the one classed with "current-cat". I'm shure it has to do something with that "second loop" thing since the category that is being marked as current is the last for which I've called the loop for and if I call the wp_list_categories() before the second loops it works all right.
I'm not sure if this is a bug or a feature but if it's the former this I think would be the best place to start fixing it:
//wp-includes/category-template.php around line 245 if ( is_category() ) $r['current_category'] = $wp_query->get_queried_object_id();
The logic in Walker_Category::start_el() seems correct.