2010-12-03 61 views

回答

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); 
+0

似乎没有工作。我只是回应了结果,它似乎没有回应任何事情,如果($ is_only_child){回声'是'; } – ApPeL 2010-12-06 10:59:59

相关问题