title: Wordpress dynamic page tree menu in sidebar
body: <p>I'm trying to generate a page tree submenu list based on the currently active top page level. The comlete page tree is as follows:</p>
  
  <p>1.0.0 top page item</p>
  
  <ul>
  <li>1.1.0 child page item
  <ul>
  <li>1.1.1 grandchild page item</li>
  <li>1.1.2 grandchild page item</li>
  </ul></li>
  <li>1.2.0 child page item
  <ul>
  <li>1.2.1 grandchild page item</li>
  <li>1.2.2 grandchild page item</li>
  </ul></li>
  <li>1.3.0 child page item
  <ul>
  <li>1.3.1 grandchild page item</li>
  <li>1.3.2 grandchild page item</li>
  </ul></li>
  </ul>
  
  <p>2.0.0 top page item</p>
  
  <p>3.0.0 top page item</p>
  
  <p>(Second and third top page items have similar hierarchy)</p>
  
  <p>I want the page tree in my sidebar.php with the following behaviour:</p>
  
  <ul>
  <li>Only the currently active top page with all its children and all
  their grandchildren expanded when navigating this spesific top page
  branch</li>
  <li>Current page item and current parent highlighted.</li>
  <li>Other top page items are hidden</li>
  </ul>
  
  <p>I short this means that the whole sidebar menu changes when moving between top pages but remains unchanged within the branch/navigation of a each top page down to single page.</p>
  
  <p>Furthermore I'm like to display the page items by menu order.</p>
  
  <p>Does anyone have a code snippet og thoughts on how to achieve this? </p>