Opened 13 years ago
Closed 13 years ago
#24428 closed defect (bug) (fixed)
wp_list_categories 'show_option_all' have not class element
| Reported by: | Alexufo | Owned by: | nacin |
|---|---|---|---|
| Priority: | normal | Milestone: | 3.8 |
| Component: | Template | Version: | 2.2 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: |
Description
wp_list_categories 'show_option_all' link to all categories .
But this link have not class like overs li elements.
Try this
<? $args = array(
'show_option_all' => 'All',
'orderby' => 'name',
'order' => 'ASC',
'style' => 'list',
'show_count' => 1,
'hide_empty' => 1,
'use_desc_for_title' => 0,
'child_of' => 0,
'feed' => '',
'feed_type' => '',
'feed_image' => '',
'exclude' => '',
'exclude_tree' => '',
'include' => '',
'hierarchical' => 1,
'title_li' => '',
'show_option_none' => __('No categories'),
'number' => null,
'echo' => 1,
'depth' => 0,
'current_category' => 1,
'pad_counts' => 0,
'taxonomy' => 'category',
'walker' => null
); ?>
<?php wp_list_categories($args); ?>
You will get
<!--This li element have not class --><li><a href="">All</a></li> <li class="cat-item cat-item-35"><a></a></li> <li class="cat-item cat-item-4"><a></a></li>
Attachments (1)
Change History (9)
#2
@
13 years ago
Thanks! But all li elements highlighted by .current-cat class.
This class not apply at 'show_option_all' => 'All' link.
<!--This li element didn't has class if activated like others --><li class="cat-items-all"><a href="">All</a></li> <li class="cat-item cat-item-35"><a></a></li> <li class="cat-item cat-item-4"><a></a></li>
#3
@
13 years ago
Well, it's not really a category, so .current-cat doesn't seem applicable here.
We could probably add .current-list-item class (similar to .current-menu-item for nav menus). Not sure if that's necessary though, a simple workaround for a theme that uses body_class() is .home .cat-items-all (with 24428.patch) or .home .categories > ul > li:first-child.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
24428.patch adds
.cat-items-alland.cat-items-none.A workaround is
.categories > ul > li:first-child.