Problem with sub-pages, parents pages…
-
Hello all !
I’m got a problem with some WordPress code. I hope i’ll be clear enough for you to help me ??
I’ve got a page structure like this :
a -> b -> c,d,e -> f -> g,h,i
I would like to have a “submenu” on my blog, depending on the parent (on depth 1) of the current page. IE, on page “d”, i’d like to show the whole tree under the page “a” :
a -> b -> c,d,e
I guess i’ll have to use wp_list_pages(‘child_of=a’); at some point, this part is ok (‘a’ being replaced by its ID).
But, can I find a way to easily retrieve the ID of ‘a’ (the “grand-parent”) when on page c or d ?
Should I make a loop with something like “while parent page is not on depth 1, get the parent” ?
(there can be more than 3 depths, but not so many, so the loop should be ok)If so, coud you please help me writing this loop ?
HSome hints may be enough, I don’t ask you to do all the work ??Thanks a lot !
- The topic ‘Problem with sub-pages, parents pages…’ is closed to new replies.