In my sidebar I want to list child pages of the current page. Therefore I am checking to see whether a page is a subpage or not using the code here:
The problem is, is that if a page is a sub page and also has sub pages then it only returns as being a sub page and not a parent of other pages.
Basically I want it so that when you click on a page the sidebar shows any subpages. If there are no sub pages at the top level then nothing shows. If there are subpages it shows them. If one of these sub pages is clicked on and also has sub pages then the sub pages are shown. If it doesn't then other pages at the same level are shown.
Anyone any ideas?