Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




get_page_children [ WordPress Function ]

get_page_children ( $page_id, $pages )
Parameters:
  • (int) $page_id Page ID.
  • (array) $pages List of pages' objects.
Returns:
  • (array)
Defined at:



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.

Source


<?php
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;
}
?>

Examples [ wp-snippets.com ]

Top Google Search Results

More ...

0 User Note(s)

None yet. Be the first!

Add New ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics