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



walk_page_tree › WordPress Function

Since2.1.0
Deprecatedn/a
walk_page_tree ( $pages, $depth, $current_page, $args )
Parameters: (4)
  • (array) $pages
    Required: Yes
  • (int) $depth
    Required: Yes
  • (int) $current_page
    Required: Yes
  • (array) $args
    Required: Yes
Uses:
  • Walker_Page
Returns:
  • (string)
Defined at:
Codex:

Retrieves HTML list content for page list.



Source

function walk_page_tree( $pages, $depth, $current_page, $args ) {
	if ( empty( $args['walker'] ) ) {
		$walker = new Walker_Page();
	} else {
		/**
		 * @var Walker $walker
		 */
		$walker = $args['walker'];
	}

	foreach ( (array) $pages as $page ) {
		if ( $page->post_parent ) {
			$args['pages_with_children'][ $page->post_parent ] = true;
		}
	}

	return $walker->walk( $pages, $depth, $args, $current_page );
}