get_page_hierarchy [ WordPress Function ]
get_page_hierarchy ( $pages, $page_id = 0 )
| Parameters: |
|
| Returns: |
|
| Defined at: |
|
Soorgelijke functies: _get_term_hierarchy, get_page_uri, get_page_link, get_page_template, get_page_children
Order 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
Source
<?php
function &get_page_hierarchy( &$pages, $page_id = 0 ) {
if ( empty( $pages ) ) {
$result = array();
return $result;
}
$children = array();
foreach ( (array) $pages as $p ) {
$parent_id = intval( $p->post_parent );
$children[ $parent_id ][] = $p;
}
$result = array();
_page_traverse_name( $page_id, $children, $result );
return $result;
}
?>
Examples [ wp-snippets.com ]
Top Google zoekresultaten
- Function Reference/get page hierarchy « WordPress Codex
Description. Order the pages with children under parents in a flat list. Usage. <? php get_page_hierarchy( $posts, $parent ) ?> Parameters. $posts: (array) ...
codex.wordpress.org - #10853 (improve get_page_hierarchy) – WordPress Trac
current get_page_hierarchy has O(N*N) complexity. It is super slow when N is a few thousands. We should improve this to O(N) using techniques similar to ...
core.trac.wordpress.org - get_page_hierarchy (WordPress Function) - WPSeek.com
WordPress lookup for get_page_hierarchy, a WordPress Function. wpseek.com is a WordPress-centric search tool for developers and theme authors.
wpseek.com - get_page_hierarchy | A HitchHackers guide through WordPress
Feb 12, 2011 ... Source code. function &get_page_hierarchy( &$pages, $page_id = 0 ) { if ( empty ( $pages ) ) { $result = array(); return $result; } $children ...
hitchhackerguide.com