wordpress只显示当前页的子页

<?php
if ($post->post_parent)    {

$ancestors=get_post_ancestors($post->ID);

$root=count($ancestors)-1;

$parent = $ancestors[$root];

} else {

$parent = $post->ID;

}
$children = wp_list_pages(“title_li=<h3>&child_of=”. $parent .”&echo=0″);
?>
<div id=”sidebar”>
<div id=”wrapbox”>
<?php if ( !function_exists(‘dynamic_sidebar’) || !dynamic_sidebar() ) : ?>        <?php endif; ?>

<div>
<ul>
<? if ($children) { ?>
<?php echo $children; ?>
<? }?>
</ul>
</div>

滚动至顶部