You want to add a class to the <li>
and <a>
elements that are produced in the output of wp_list_pages? Is that right?
yes, but only for those <li>
and <a>
which has another <ul>
(for subpages) nested – so only those <li>
and <a>
that are parents
wp_list_pages already assigns classes..
If you want to style them differently just use the classes..
Top level..
ul li.page-item {}
child level lists..
ul li.page-item ul {}
ul li.page-item ul li.page-item {}
child child..
ul li.page-item ul li.page-item ul {}
ul li.page-item ul li.page-item ul li.page-item {}
and so on…
You’ll need some heavy regex to do it otherwise.. I’m not quite that hot with regex, else i’d write you something..