Can't display hierarchical page list
-
I am using code from the wp_list_pages page of the Codes to display a list of child pages, grandchildren, and great grandchildren. The code I’m using should display the same list on any page of the site, always showing the same list. The code is:
$parent = 6;
$args=array(
'child_of' => $parent
);
$pages = get_pages($args);
if ($pages) {
$pageids = array();
foreach ($pages as $page) {
$pageids[]= $page->ID;
}$args=array(
'title_li' => '',
'include' => implode(",", $pageids),
);
wp_list_pages($args);
}However, what is actually output on the page is a flat list of the pages I requested. All the pages are there, but it will not, under any circumstances, display the list as hierarchical nor will it respect menu ordering.
What am I doing wrong? Thanks so much in advance!
- The topic ‘Can't display hierarchical page list’ is closed to new replies.