[wp-hackers] wp_list_categories()

Mike Schinkel mikeschinkel at gmail.com
Wed Dec 31 04:28:30 GMT 2008


FYI, this is what I ended up with that worked really well for my needs:

<dl class="categories">
 <dt class="category-54">Top #2</dt>
 <dd class="category-54">
  <ul>
   <li class="parent category-54"><a href="/category/top-2/">Top #2</a>
(537)</li>
   <li class="children category-54">
    <ul>
     <li class="child category-90"><a href="/category/top-2/one/">One</a>
(290)</li>
     <li class="child category-70"><a href="/category/top-2/two/">Two</a>
(202)</li>
     <li class="child category-89"><a
href="/category/top-2/three/">Three</a> (29)</li>
    </ul>
   </li>
  </ul>
 </dd>
 <dt class="category-54">Top #2</dt>
 <dd class="category-54">
  <ul>
   <li class="parent category-54"><a href="/category/top-2/">Top #2</a>
(537)</li>
   <li class="children category-54">
    <ul>
     <li class="child category-90"><a href="/category/top-2/one/">One</a>
(290)</li>
     <li class="child category-70"><a href="/category/top-2/two/">Two</a>
(202)</li>
     <li class="child category-89"><a
href="/category/top-2/three/">Three</a> (29)</li>
    </ul>
   </li>
  </ul>
 </dd>
</dl>

The DT is used for a collapsed list that, when clicked, opens to a
heirarchical list of links that include that top level category as well as
its subcategories.

And not withstanding Lynne's comments I'd argue that while not a textual
"definition" this usage of having the definition be the associated
subcategories reasonably meets the intention for DD.  Looking at the HTML5
draft (http://www.whatwg.org/specs/web-apps/current-work/#the-dd-element)
which in the case of DD attempts to describe DD in ways that the HTML4 spec
didn't, DD is described as:

*The dd <http://www.whatwg.org/specs/web-apps/current-work/#the-dd-element>element
represents the description, definition, or value, part of a
term-description group in a description list
(dl<http://www.whatwg.org/specs/web-apps/current-work/#the-dl-element>element)
*

 So in this case the subcategories are the "*value*" for the top level
category. FWIW.

-Mike Schinkel
http://mikeschinkel.com


More information about the wp-hackers mailing list