If you’re trying to style nested items in
wp_list_pages() the task can be daunting. You’ll apply a style to an
<li> then have to unapply those styles for the nested
<li>s, and if you’re dropdowns get any deeper, you CSS can become overwhelming. It’s a little better if you don’t care about IE, because then you can use those fancy CSS selectors like
ul > li, or
ul li > li to target certain depths. But if you’re stuck fighting with IE, maybe this will help.
Just stick this in your functions.php file (plugin coming soon) and you’ll end up with a few extra class to help you out. (See sample output at the end.)
You can now download the plugin version from this page. I’ve made some improvements to the code as well as added support for
These classes are added in addition to what WordPress supplies. Classes are added according to depth, rather than parent-child relationships.