Opened 11 years ago
Closed 11 years ago
#24428 closed defect (bug) (fixed)
wp_list_categories 'show_option_all' have not class element
Reported by: | Alexufo | Owned by: | nacin |
---|---|---|---|
Milestone: | 3.8 | Priority: | normal |
Severity: | normal | Version: | 2.2 |
Component: | Template | Keywords: | has-patch |
Focuses: | Cc: |
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)
#1
@
11 years ago
- Component changed from Query to Template
- Keywords has-patch added
- Version changed from 3.5.1 to 2.2
#2
@
11 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
@
11 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
.
Note: See
TracTickets for help on using
tickets.
24428.patch adds
.cat-items-all
and.cat-items-none
.A workaround is
.categories > ul > li:first-child
.