Wordpress列出带有页面内容的嵌套页面

I am using this code to retrieve a nested list of pages in Wordpress:

<?php wp_list_pages( $args ); ?>

It gives me an output similar to this one:

<ul>
    <li>Page Title 1</li>
    <li>Page Title 2
        <ul>
            <li>Page Title 3</li>
            <li>Page Title 4</li>
        </ul>
    </li>
    <li>Page Title 5</li>
</ul>

I need an output like this:

<ul>
    <li>Page Title 1 / Page Content 1</li>
    <li>Page Title 2 / Page Content 2
        <ul>
            <li>Page Title 3 / Page Content 3</li>
            <li>Page Title 4 / Page Content 4</li>
        </ul>
    </li>
    <li>Page Title 5 / Page Content 5</li>
</ul>

I believe you'll need to use get_pages() instead, which will return an array of page objects. However, this wont give you the hierarchy you need to set up the sub menus. You could overcome this by only grabbing the top level items, then iterating through each and checking for sub pages:

<?php

$pages = get_pages( array(
    'sort_column' => 'menu_order',
    'parent' => 0,
));

?>

<ul>

<?php foreach( $pages as $page ): ?>
    <?php $title = $page->post_title; ?>
    <?php $content = apply_filters('the_content', $page->post_content); ?>
    <?php $children = get_pages( array( 'child_of' => $page->ID ) );?>

    <li>

    <?php echo $title . " / " . $content; ?>

    <?php if ( count( $children ) != 0 ): ?>

        <ul>

        <?php foreach( $children as $child ):
            <?php $title = $child->post_title; ?>
            <?php $content = apply_filters('the_content', $child->post_content); ?>

            <li><?php echo $title . " / " . $content; ?></li>

        <?php endforeach; ?>

        </ul>

    <?php endif; ?>

    </li>

<?php endforeach;?>

</ul>