function to list parent and child page
-
I have seen several questions about this on the forum, but couldn’t find any that have been answered.
In my header.php I would like to add a navigation link to a parent page and its children. But I can’t find a way to do this simply with a function (so it will automatically update when new child pages are added). I’ve done it with “include” like this:
<?php wp_list_pages('title_li=&include=1357,1368&depth=2'); ?>
1357 is the parent, and 1368 is the child.
But I don’t want to have to manually edit my header file every time I add a new child page. Of course, I could use “exclude” and add all the pages that I DON’T want to show up, but that also means manual editing every time I add a page. Ugh.
Is there a simple way to to list a parent and its children (for navigation) with a function? So sorry if I’ve missed this in the codex, but wp_page_menu doesn’t seem to do the trick either.
Thanks,
Lori
- The topic ‘function to list parent and child page’ is closed to new replies.