I would like to list the sub pages inside a page. I am using runPHP to run php inside my page... For some reason this piece of script returns "4" ?!?!
<?php
$current_page_id = the_ID();
wp_list_pages("child_of=$current_page_id");
?>
I would like to list the sub pages inside a page. I am using runPHP to run php inside my page... For some reason this piece of script returns "4" ?!?!
<?php
$current_page_id = the_ID();
wp_list_pages("child_of=$current_page_id");
?>
the_ID() doesn't return the ID for use in PHP, it inserts it into the page, which is why it's showing up.
Try this:
wp_list_pages("child_of=$id");
and if that doesn't work and the following just before it:
global $id;
where do u put this code?? has it worked yet??
i too want to show my sub pages in my parent page..
this code works perfectly, and unlike a lot of code floating around the support forums, it also displays the submenu when you're on child page:
<ul>
<?php if(get_the_title($post->post_parent) != the_title(' ' , ' ',false)) {
wp_list_pages("child_of=".$post->post_parent."&sort_column=menu_order&title_li=");
} else {
wp_list_pages("child_of=".$post->ID."&sort_column=menu_order&title_li=");
}
?>
</ul>This topic has been closed to new replies.