0
我正在尝试做一个声明,检查当前页面是否是wordpress中唯一的grand child page
,并且似乎无法将其包裹在它周围。wordpress check如果当前页面是唯一的大孩子
即2级深
父>子>孙子
如果有超过1个孙子页,执行操作。
我正在尝试做一个声明,检查当前页面是否是wordpress中唯一的grand child page
,并且似乎无法将其包裹在它周围。wordpress check如果当前页面是唯一的大孩子
即2级深
父>子>孙子
如果有超过1个孙子页,执行操作。
$siblings = get_posts(array(
'exclude' => array($post->ID),
'post_type' => $post->post_type,
'post_parent' => $post->post_parent,
'numberposts' => 1 // we're only checking if there ARE siblings, so save a little memory
));
$is_only_child = empty($siblings);
似乎没有工作。我只是回应了结果,它似乎没有回应任何事情,如果($ is_only_child){回声'是'; } – ApPeL 2010-12-06 10:59:59