title: Wordpress list child pages on child page using foreach loop
body: <p>I'm using a foreach loop to list child pages on a parent page, which works great. However, the child pages don't list on a child page, which is what I'd like.</p>
  
  <p>Here's what works for the parent page so far:</p>
  
  <pre><code>&lt;?php
  
  $nav = array(
      'post_type' =&gt; 'page',
      'orderby' =&gt; 'title',
      'order' =&gt; 'ASC',
      'post_parent' =&gt; $post-&gt;ID
  );
  
  $child_pages = get_posts($nav);
  
  ?&gt;
  &lt;ul&gt;
      &lt;?php foreach ($child_pages as $child_page) : ?&gt;
          &lt;li&gt;
              &lt;a href="&lt;?=get_permalink($child_page-&gt;ID); ?&gt;"&gt;&lt;?=$child_page-&gt;post_title; ?&gt;&lt;/a&gt;
          &lt;/li&gt;
      &lt;?php endforeach; ?&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>Ideally I'd like to keep using foreach rather than any other loop. I'm wondering if I need to add another loop inside my existing loop, but I'm unsure how to proceed. </p>
  
  <p>Any help would be much appreciated.</p>