List all pages and children in separate ul

your code is missing the = after child_of

<?php
$args = array(
    'sort_column' => 'menu_order',
    'parent' => 0,
    );
$pages = get_pages($args);
foreach($pages as $page){
    ?>
    <ul>
        <li>
        <?php 
        echo '<a href="' . get_permalink( $page->ID ) . '">' . $page->post_title . '</a>';
        ?>  
        </li>
        <?php  
        wp_list_pages('title_li=&depth=0&child_of=".$page->ID."');
        ?>  
    </ul>
    <?php
    }
?> 

if you want to make sure to only show one level of child pages, consider to set the 'depth' parameter to 1

Leave a Comment