WordPress企业主题定制/开发/优化

wordpress只显示当前页的子页

首页 » WORDPRESS主题技术 » 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>

相关项目

  • WordPress外贸企业主题

  • 最近更新

  • 热门标签