【发布时间】:2016-05-07 00:55:36
【问题描述】:
我在 WordPress 中有以下导航结构:
Page
Sub Page
Child Page
Child Page
Child Page
Page
Sub Page
Child Page
Child Page
Child Page
Page
Sub Page
Child Page
Child Page
Child Page
在每个子页面和子页面上,我想在侧边栏中显示以下内容:
Sub Page
Child Page
Child Page
Child Page
我最接近的是来自here的以下代码:
<ul>
<?php
global $post;
$current_page_parent = ( $post->post_parent ? $post->post_parent : $post->ID );
wp_list_pages( array(
'title_li' => '',
'child_of' => $current_page_parent,
'depth' => '1' )
);
?>
</ul>
但是,在子页面上,它只显示所有子页面的列表(没有子页面),在子页面上,它显示该部分的子页面列表,但缺少父子页面标题。
如何修改以实现我想要的?
谢谢!
【问题讨论】: