我正在执行以下操作以获取当前正在管理的页面的子项:
$args = array(
'depth' => 0,
'child_of' => get_the_ID(),
'title_li' => '',
'echo' => 0,
);
wp_list_pages($args);
输出是子页面的标题,并且它是链接的,我想做的是对标题和链接进行封装,以便输出类似于 " http://thelink.com title"。
这可能吗?
问候,埃米尔
答案 0 :(得分:2)
在这里,享受
如果 $post->ID
且get_the_ID()
相同,请使用 $post->ID
global $post;
$currentPageID = $post->ID;
$Childpages = get_pages('sort_column=menu_order&hierarchical=0&parent=' . $currentPageID . '&exclude=');
foreach ($Childpages as $page){
echo "Child Page ID: ".$page->ID ."<br>";
echo "Child Page Name: ".$page->post_title ."<br>";
}