Get all pages under a parent page. Prefer WP query; query_posts() is deprecated.
<?php
query_posts([
'post_parent' => $post->ID,
'post_type' => 'page',
'posts_per_page' => -1,
]);
if (have_posts()) {
echo '<ul>';
while (have_posts()) {
the_post();
printf(
'<li><a href="%s">%s</a></li>',
esc_url(get_permalink()),
esc_html(get_the_title()),
);
}
echo '</ul>';
}
wp_reset_query();
?>
template.php