Make WordPress Core

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)

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

Download all attachments as: .zip

Change History (9)

#1 @SergeyBiryukov
13 years ago

  • Component Query → Template
  • Keywords has-patch added
  • Version 3.5.1 → 2.2

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

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

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

#4 @Alexufo
13 years ago

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

#5 @SergeyBiryukov
13 years ago

  • Milestone Awaiting Review → 3.7

#6 @nacin
13 years ago

  • Milestone 3.7 → 3.8

Honestly curious what the use case here is.

#7 @Alexufo
13 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 13 years ago by Alexufo (previous) (diff)

#8 @nacin
13 years ago

  • Owner set to nacin
  • Resolution → fixed
  • Status new → 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.