I am trying to develop a page tree submenu list in line with the presently active top page level. The comlete page tree is the following:

1.. top page item

  • 1.1. child page item
    • 1.1.1 grandchild page item
    • 1.1.2 grandchild page item
  • 1.2. child page item
    • 1.2.1 grandchild page item
    • 1.2.2 grandchild page item
  • 1.3. child page item
    • 1.3.1 grandchild page item
    • 1.3.2 grandchild page item

2.. top page item

3.. top page item

(Second and third top page products have similar hierarchy)

I would like the page tree during my sidebar.php using the following behavior:

  • Just the presently active top page with all of its children and all sorts of their grandchildren broadened when moving this spesific top page branch
  • Current page item and current parent outlined.
  • Some of the best page products are hidden

I short which means that the entire sidebar menu changes when moving between top pages but remains unchanged inside the branch/navigation of the each top page lower to single page.

In addition I am prefer to display the page products by menu order.

Does anybody possess a code snippet og ideas regarding how to accomplish this?

Ah, I handled to resolve it. Initially I could not determine in which the current page item class choose to go. It labored at single page level although not at parent or ancestor level. I needed to place the next before the sidebar inclusion within the template: <?php wp_reset_query(); ?> This disguarded that bug.

Next i selected to cover all page products with css display:none and just show page products using the class current_page_item, current_page_parent and current_page_ancestor with display:block.

Finally here's the code to get the page list situated during my sidebar: <?php wp_list_pages('sort_column=menu_order'); ?>

There you have it and that is that!

Works perfectly!

However, I am no php guru therefore if anybody can present me having a more elegant approach I' all ears!