Hi,
I know this question and similar approximations of it have cropped up several times on the forums, but I've not yet found a solution that works for me (partly because much of the code that might have been useful on e.g. this post has been 'moderated as per the Forum Rules' – pah!)
Here's my menu structure:
• PAGE ONE
- subpage one
- subpage two
- subpage three
• PAGE TWO
- another subpage one
- another subpage two
- another subpage three
Here's what I want to achieve:
If I'm on a child page, I only want to see menu items that are siblings of, or the parent of that child. For example, if I was on 'subpage one', I would want my menu to display this:
• PAGE ONE
- subpage one
- subpage two
- subpage three
• PAGE TWO
It's worth pointing out that if I was on a parent page, I would also like to see the children pages of that parent. For example, if I was on 'PAGE ONE' I would also want my menu to display this:
• PAGE ONE
- subpage one
- subpage two
- subpage three
• PAGE TWO
For the record, this custom walker came painfully close to working for me, but it only worked for the first parent page, i.e. when I was on PAGE ONE, the correct subpages displayed, but when I was on PAGE TWO, no subpages were displayed.
I hope to understand php walkers before too long, but I'm definitely not there yet; not even enough to fiddle with someone else's.
If anyone can point me in the direction of a custom walker that will achieve what I'm after (making use of wp_nav_menu), I'd be very grateful.
Thanks very much,
D