我编写了下面的函数来列出当前页面的子页面。现在我要做的是在短代码中使用特定页面的slug列出其子页面。
是否可以将属性潜入wp\\U list\\u页面?因此,例如,如果您想列出某个父段的页面,您可以在下面的短代码中指定父段[childpages parent=“projects”),我在这里有点困惑
function list_child_pages()
{
global $post;
$childpages = wp_list_pages(\'sort_column=menu_order&title_li=&child_of=\' . $post->post_parent . \'&echo=0\');
if ($childpages)
{
$string = \'<ul>\' . $childpages . \'</ul>\';
}
return $string;
}
add_shortcode(\'childpages\', \'list_child_pages\');