[wp-trac] [WordPress Trac] #18256: Close the current-cat li before the children
WordPress Trac
wp-trac at lists.automattic.com
Tue Jul 26 04:49:11 UTC 2011
#18256: Close the current-cat li before the children
--------------------------+----------------------
Reporter: betsyk | Owner:
Type: defect (bug) | Status: closed
Priority: normal | Milestone:
Component: Template | Version: 3.2.1
Severity: normal | Resolution: invalid
Keywords: |
--------------------------+----------------------
Changes (by dd32):
* component: General => Template
Old description:
> In a hierarchical category list, children adopt the current-cat class
> from parents. This is due to the Walker_Category structure which nests
> <ul class='children'> inside the <li> of the parent list. The parent list
> should be closed before the child <ul> begins.
>
> Let's say I have a list of categories:
>
> <ul><?php wp_list_categories('style=list&hierarchical=1&depth=0');
> ?></ul>
>
> And I want to style the current category:
>
> `.current-cat {
> background-color: #cccccc;
> }`
>
> The HTML output is this:
>
> <ul><li class="cat-item cat-item-21 current-cat"><a
> href="http://mysite/category/food/cookies">cookies</a>
> <ul class='children'><li class="cat-item cat-item-107"><a
> href="http://mysite/category/food/cookies/oatmeal">oatmeal</a></li></ul></li></ul>
>
> It should be this:
>
> <ul><li class="cat-item cat-item-21 current-cat"><a
> href="http://mysite/category/food/cookies">cookies</a></li><ul
> class='children'><li class="cat-item cat-item-107"><a
> href="http://mysite/category/food/cookies/oatmeal">oatmeal</a></li></ul></ul>
>
> Didn't see anything related in the open tickets - hopefully this isn't a
> duplicate bug report.
New description:
In a hierarchical category list, children adopt the current-cat class from
parents. This is due to the Walker_Category structure which nests <ul
class='children'> inside the <li> of the parent list. The parent list
should be closed before the child <ul> begins.
Let's say I have a list of categories:
<ul><?php wp_list_categories('style=list&hierarchical=1&depth=0'); ?></ul>
And I want to style the current category:
.current-cat {
background-color: #cccccc;
}
The HTML output is this:
<ul><li class="cat-item cat-item-21 current-cat"><a
href="http://mysite/category/food/cookies">cookies</a>
<ul class='children'><li class="cat-item cat-item-107"><a
href="http://mysite/category/food/cookies/oatmeal">oatmeal</a></li></ul></li></ul>
It should be this:
<ul><li class="cat-item cat-item-21 current-cat"><a
href="http://mysite/category/food/cookies">cookies</a></li><ul
class='children'><li class="cat-item cat-item-107"><a
href="http://mysite/category/food/cookies/oatmeal">oatmeal</a></li></ul></ul>
Didn't see anything related in the open tickets - hopefully this isn't a
duplicate bug report.
--
Comment:
just reverting that description change.. Didn't mean to add it to the
final comment.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/18256#comment:2>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list