wp_list_pages – children in same list
-
I’ve been searching and experimenting for a solution to an issue I have with wp_list_pages but have come up empty handed.
As it stands, I’m displaying in my sidebar a list of child pages (for the page the user is on) and then in that list any children of children.
This currently outputs as:
<ul> <li>Child page 1</li> <li>Child page 2 <ul class="children"> <li>Child of child page 2</li> <li>Another child of child page 2</li> </ul> </li> <li>Child page 3</li> <li>Child page 4</li> </ul>I’m trying to add something to my functions file so that children of children are displayed in the same list (not with a separate ul declaration inside a list item) and then given a class.
The ideal output would be:
<ul> <li class="secondary">Child page 1</li> <li class="secondary">Child page 2</li> <li class="tertiary">Child of child page 2</li> <li class="tertiary">Another child of child page 2</li> <li class="secondary">Child page 3</li> <li class="secondary">Child page 4</li> </ul>Any help would be much appreciated.
The topic ‘wp_list_pages – children in same list’ is closed to new replies.