Dynamically generate submenu based on parent page
-
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:
1.0.0 top page item
– 1.1.0 child page item
– – 1.1.1 grandchild page item
– – 1.1.2 grandchild page item
– 1.2.0 child page item
– – 1.2.1 grandchild page item
– – 1.2.2 grandchild page item
– 1.3.0 child page item
– – 1.3.1 grandchild page item
– – 1.3.2 grandchild page item2.0.0 top page item
3.0.0 top page item(Second and third top page items have similar hierarchy)
I want the page tree in my sidebar.php with the following behaviour:
- Only the currently active top page with all its children and all their grandchildren expanded when navigating this spesific top page branch
- Current page item and current parent highlighted.
- Other top page items are hidden
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.
Furthermore I’m like to display the page items by menu order.
Does anyone have a code snippet og thought on how to achieve this?
- The topic ‘Dynamically generate submenu based on parent page’ is closed to new replies.