How to get the ID of Child Pages?
-
I need some help to get the child id of a page. I am grabbing the content off the child page, and displaying the content in a text box on the parent page.
I have achieved this previously by just sticking in the page ID’s in the code – but i want a dynamice way to do this.
I searched the codex and found get_page_children, which I think returns what I need – I just don’t know how to get the page ID’s out of this?
Here is what i have so far:
$my_wp_query = new WP_Query(); $all_wp_pages = $my_wp_query->query(array('post_type' => 'page')); $current_page_ID = $post->ID; $child_pages = get_page_children( $current_page_ID, $all_wp_pages ) //need to get the child page ID from $child_pages...then add in below // echo getPageContent(ID_of_the_child_page);
For the site I am creating I only have one child page, so i really am most interested in getting the ‘first’ child page ID.
Can you help?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘How to get the ID of Child Pages?’ is closed to new replies.