Hi,
Does anybody know the code for listing the children of a page where you know the page's id?
Cheers!
Hi,
Does anybody know the code for listing the children of a page where you know the page's id?
Cheers!
You are probably looking for this
http://codex.wordpress.org/Template_Tags/wp_list_pages#List_Sub-Pages
Thank you, buddha trance, I'd been there. What I want is a list of all the children of a certain page. I actually want to list on page "Africa" it's children: "Angola" "Benin" "Botswana" etc.
I might have missed something in that link.
I'm not there yet but I'm going a long way with this plugin:
robcub, I just tested adding this to page.php of my theme, and it worked, displaying child pages on a parent page
<ul>
<?php
wp_list_pages('title_li=&child_of='.$post->ID.''); ?>
</ul>Thank you, buddha trance, that's great. And if you want to display the child pages of a particular parent, say the page id is 5, you can do this on any page:
<ul>
<?php
wp_list_pages('title_li=&child_of=5') ?>
</ul>
It wasn't me that worked that out.
If you want to put either of these into the body of a page or post using Exec-PHP plugin, the code with the dynamically created post id doesn't work (it lists all pages and children) whereas the one with the specified page id does!
Thank you all... I have been searching for something like this for hours...
This topic has been closed to new replies.