Definition:
function &get_page_children($page_id, $pages) {}
Retrieve child pages from list of pages matching page ID.
Matches against the pages parameter against the page ID. Also matches all children for the same to retrieve all children of a page. Does not make any SQL queries to get the children.
Parameters
- int $page_id: Page ID.
- array $pages: List of pages’ objects.
Source code
function &get_page_children($page_id, $pages) { $page_list = array(); foreach ( (array) $pages as $page ) { if ( $page->post_parent == $page_id ) { $page_list[] = $page; if ( $children = get_page_children($page->ID, $pages) ) $page_list = array_merge($page_list, $children); } } return $page_list; }
1534
No comments yet... Be the first to leave a reply!