0
votes

I'm displaying my categories using the wp_list_categories function like so:

<?php wp_list_categories('selected=6&title_li='); ?>

Now, when clicking on each category link and loading the category page, the "active" cat has a class of "current-cat" on the list element.

How can I have this current-cat class display on a specific category by default on the index page?

I have a category named "All" which contains all posts (obviously) and I want this to have the class "current-cat" when calling the wp_list_categories by default.

Is this possible?

1

1 Answers

1
votes

Well the easiest solution would be CSS in my guess. If the category is the first category in the list (first link in the list), and my guess is that it should be (all is above all, right ?) then you can just do simple CSS:

.category-widget a.current-cat, 
.home .category-widget a:first-child  {
    color:black;
}

http://www.w3.org/TR/selectors/