tags:

views:

22

answers:

2

Hi guys this looks doable but I cant quite figure it out. I have a lists of pages in wordpress

Page1
Page2
Page3
Page4

when you are on a page need to display it's children but only it's children and not the children of the other pages (which all have children)

Page1
Page2
    -child1
    -child2
    -child3
        --grandchild1
        --grandchild2
    -child4
Page3
Page4

I have checked the codex but I don't think it does this? Can anyone help?

Thanks Jamie

A: 

Sure, you can do this with get_page_children(). It takes a parent page ID and an array of all pages and returns a filtered array that only contains the pages that are children of the parent page.

Pat
Thanks for the help guys. These examples worked but now I need to another layer to the navigation so it looks like this:Parent1-Page1-Page2 --child1 --child2 -child3 ---grandchild1 ----grandchild2 --child4-Page3-Page4Parent2Parent3If I list the current pages children, because now all pages (page1 page2 page3 etc) are a child of parent 1, all of their pages get listed instead of just page 2's children
jamie holliday
+1  A: 

You can also use wp_list_pages('childof=$parentPageID');

kevtrout