Skip to content

Instantly share code, notes, and snippets.

@kachi
Last active July 20, 2016 00:25
Show Gist options
  • Save kachi/7778d1ff21c8d33e414d4e815680d1f9 to your computer and use it in GitHub Desktop.
Save kachi/7778d1ff21c8d33e414d4e815680d1f9 to your computer and use it in GitHub Desktop.
<?php
// 指定したIDの子孫を階層でリスト表示
$parent = ここに親のID;
$args=array(
'child_of' => $parent
);
$pages = get_pages($args);
if ($pages) {
$pageids = array();
foreach ($pages as $page) {
$pageids[]= $page->ID;
}
$args=array(
'title_li' => '',
'include' => $parent . ',' . implode(",", $pageids)
);
wp_list_pages($args);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment