//正确的代码
功能。php
function get_page_parent_id( $id ) {
$args = array(
\'sort_order\' => \'ASC\',
\'sort_column\' => \'menu_order\',
\'child_of\' => $id
);
$args = get_pages($args);
if(is_array($pages))
$pageID = $id;
else {
$pageID = wp_get_post_parent_id( $id );
}
return $pageID;
}
?>
第页。php
<?php
$parentID = get_page_parent_id(get_the_ID());
$childArgs = array(
\'sort_order\' => \'ASC\',
\'sort_column\' => \'menu_order\',
\'child_of\' => $parentID
); ?>
<div class="subnav">
<h3 class="subnav-headline"><a href="/over-ons" class="c-dark"><?php echo get_the_title($parentID); ?></a></h3>
<ul class="menu-items menu-level-1 menu-count-5">
<?php $pages = get_pages($childArgs);
foreach($pages as $page ) { ?>
<li class="menu-item item-number-2 item-id-84286 item-even item-page item-node item-alias-over-ons-geschiedenis-leonidas"><a href="<?php echo get_the_permalink($page);?>"><?php echo $page->post_title;?></a></li>
<?php } ?>
</ul>
</div>