Make WordPress Core

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's profile Alexufo Owned by: nacin's profile 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)

24428.patch (1019 bytes) - added by SergeyBiryukov 11 years ago.

Download all attachments as: .zip

Change History (9)

#1 @SergeyBiryukov
11 years ago

  • Component changed from Query to Template
  • Keywords has-patch added
  • Version changed from 3.5.1 to 2.2

24428.patch adds .cat-items-all and .cat-items-none.

A workaround is .categories > ul > li:first-child.

#2 @Alexufo
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 @SergeyBiryukov
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.

#4 @Alexufo
11 years ago

and what now? How to send this request to core?

#5 @SergeyBiryukov
11 years ago

  • Milestone changed from Awaiting Review to 3.7

#6 @nacin
11 years ago

  • Milestone changed from 3.7 to 3.8

Honestly curious what the use case here is.

#7 @Alexufo
11 years ago

nacin , look here serebniti.ru

You will see second menu with rubrics. First rubric is all. first li element hase been need the class.

Last edited 11 years ago by Alexufo (previous) (diff)

#8 @nacin
11 years ago

  • Owner set to nacin
  • Resolution set to fixed
  • Status changed from new to closed

In 26588:

wp_list_categories(): Add cat-item-none and cat-item-all classes to the none/all options.

props SergeyBiryukov.
fixes #24428.

Note: See TracTickets for help on using tickets.