wordpress 親子孫ページ 階層 出力
<?php
$args = array(
'posts_per_page' => '-1',
'order' => 'DESC',
'post_type' => 'post_type', // 任意のポストタイプ
'echo' => 0,
'title_li' => '<h2>H2タイトルなど</h2>',
'include' => '',
'exclude' => '',
'post_status' => 'publish',
);
query_posts($args);
?>
<ul>
<?php
$output = wp_list_pages($args);
if (is_page()) {
$page = $post->ID;
if ($post->post_parent) {
$page = $post->post_parent;
}
$children=wp_list_pages($page);
if ($children) {
$output = wp_list_pages($page);
}
}
echo $output;
?>
</ul>