Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End [Solved] WordPress – Pages/Sub Pages Menu Question Re: [Solved] WordPress – Pages/Sub Pages Menu Question

#66400
TeMc
Member

Oh, you want the childpages to appear within the menu.

In that case I’d make a php to :

* first define whether we’re on a parent, child or grandchild.
* If on a parent or child, go depth=2.
* if on a grandchild, go depth=0 or depth=3 (depth=0 is all depths, depth=3 is grandchilds – so depends on whether you’ve got sub-sub-sub-sub pages or not)

Then use CSS to hide all the subpages-menus and use CSS to show (unhide) the subpage-menu of the current active one.
ie.

Code:
ul.mymenu li ul {display:none;}
ul.mymenu li.current_page_item ul,
ul.mymenu li.current_page_parent ul,
ul.mymenu li.current_page_ancestor ul { display: block; }

So in the code you’ve NOT only outputted the childpage you wanted, instead spit them all out.
Then use CSS to hide the others. Why do it the hard way, I think this’ll do just fine.


TeMc