title: Wordpress Sub Navigation Menus in Sidebar
body: <p>I have a WordPress site with the following structure</p>
  
  <pre><code>Page 1
     Sub Page 1
     Sub Page 2
  Page 2
     Sub Page 1
        Sub-Sub Page 1
        Sub-Sub Page 2
        Sub-Sub Page 3
     Sub Page 2
     Sub Page 3
  </code></pre>
  
  <p>When on any Sub-Sub page, I want to list the Sub Page(s) in a sidebar navigation.</p>
  
  <p>Using the code below as a starting point...which doesn't work on Sub-Sub pages because it is showing the Sub-Sub pages in the navigation and not the Sub pages.</p>
  
  <pre><code>&lt;?php
    if($post-&gt;post_parent)
    $children = wp_list_pages("title_li=&amp;child_of=".$post-&gt;post_parent."&amp;echo=0");
    else
    $children = wp_list_pages("title_li=&amp;child_of=".$post-&gt;ID."&amp;echo=0");
    if ($children) { ?&gt;
    &lt;ul&gt;
    &lt;?php echo $children; ?&gt;
    &lt;/ul&gt;
  &lt;?php } ?&gt;
  </code></pre>
  
  <p>Thanks</p>
  
  <p>Brett</p>