wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren
get_page_hierarchy › WordPress Function
Seit2.0.0
Veraltetn/v
› get_page_hierarchy ( $pages, $page_id = 0 )
Parameter: (2) |
|
Gibt zurück: |
|
Definiert in: |
|
Codex: |
Orders the pages with children under parents in a flat list.
It uses auxiliary structure to hold parent-children relationships and runs in O(N) complexityÄhnliche Funktionen: get_template_hierarchy, _get_term_hierarchy, get_page_uri, get_page_link, _get_page_link
Quellcode
function get_page_hierarchy( &$pages, $page_id = 0 ) { if ( empty( $pages ) ) { return array(); } $children = array(); foreach ( (array) $pages as $p ) { $parent_id = (int) $p->post_parent; $children[ $parent_id ][] = $p; } $result = array(); _page_traverse_name( $page_id, $children, $result ); return $result; }