I want dynamic menu on the sidebar, depending if parent or child. Also, depending if current page has childs or not.
To put it more precise:
on Home i want list of parent pages (top level pages)
on each of top level pages i want list of it’s sub-pages, unless it doesn’t have any, then i want it’s siblings
on child pages (second level) i want list of it’s childs siblings (other second level pages, childs of same parent page)
so far i have this code, which i found somewhere (sorry, really don’t remember were was it):
for Home – other top level pages
for all other pages it shows theirs childs if they have them. If not it’s shows nothing, where i want the siblings to be shown
On second level (sub-pages) it shows teir siblings (so exactly what i want).
So how to change that code so that if one of top level pages don’t have childs menu will list the list of all top level pages.