Add ul to its children with get_posts
//first let’s separate all the top level pages & child pages $top_lvl = array(); $children = array(); foreach ( $values as $post ) { if( $post->post_parent ) { $children[$post->post_parent][] = $post; } else { $top_lvl[] = $post; } } //now we have all top level pages in $top_lvl //& we can access their child pages … Read more