我想以降序获得5条最新评论和每条评论的5条最新回复(儿童)。使用下面的代码,我可以获得5条最新的评论,但它无法区分评论和回复,从而生成一个独立于其“类型”(评论或回复)的评论列表。我该怎么做?
<?php
$comments = get_comments(array(
\'post_id\' => $id,
\'status\' => \'approve\',
\'number\' => \'5\' //Number of comments
));
if ( have_comments() ) : ?>
<?php $args = array(
\'walker\' => null,
\'max_depth\' => \'2\',
\'style\' => \'div\',
\'callback\' => customComment, // templates/comment-template.php
\'end-callback\' => null,
\'type\' => \'all\',
\'reply_text\' => \'Reply\',
\'page\' => \'\',
\'per_page\' => \'\',
\'avatar_size\' => 32,
\'reverse_top_level\' => false,
\'reverse_children\' => false,
\'format\' => \'html5\', // or \'xhtml\' if no \'HTML5\' theme support
\'short_ping\' => false, // @since 3.6
\'echo\' => true // boolean, default is true
); ?>
<?php wp_list_comments( $args ); ?>