Hi all,
I'm having some trouble displaying the Child Pages of the Current Page in our Sidebar Menu. We have a hierarchy on our site like this:
Classrooms (main menu link)
> First Grade
> Introduction
> Second Grade
> Special Activities
> Third Grade
> Introduction
> Homework
When a user clicks the 'Classrooms' link, the sidebar menu displays the Child Pages fine like this:
First Grade
Second Grade
Third Grade
However, when the user clicks the 'Third Grade' link, we want it to show its own Child Pages, but instead it shows the same list of pages: First Grade, Second Grade, Third Grade list as the 'Classrooms' link above.
When the user clicks the 'Homework' link (child of Third Grade), the sidebar menu lists the Third Grade child pages, which we like, fine like this:
Introduction
Homework
Here is the code we currently have in our sidebar:
$children_pages = get_pages( array( 'child_of' => $child_of, 'parent' => $child_of, 'sort_column' => 'ID', 'sort_order' => 'ASC' ) );
So the problem lies in the 'Third Grade' level link. We want to change this so when the user clicks the 'Third Grade' link, the sidebar menu displays the 'Third Grade' Child Pages (ie: Introduction & Homework) and not list First Grade, Second Grade, Third Grade.
I tried changing $child_of, 'parent'
to $child_of, 'current page'
, but displays all of the child pages and their sub-pages together like this:
First Grade
Introduction
Second Grade
Special Activities
Third Grade
Introduction
Homework
Here is where you can view it: http://www.stagnesavon.org/classroom-pages/
Can anyone share how I can accomplish this?