我基本上是在多个页面上使用“最新评论”系统,其中一个特定用户被列为评论的第一个回复(用特殊CSS突出显示),然后在这个“特殊评论”下面列出2-3个普通用户。
我希望将特定用户从普通用户列表中排除,但我无法确定。如果HTML有点混乱,很抱歉,但真正重要的是第二个$args数组。
<?php $args = array(
\'user_id\' => $curauth->ID,
\'number\' => 5,
\'status\' => \'approve\',
\'parent\' => 0
);
$comments = get_comments($args);
if ( $comments )
{
foreach($comments as $c){
echo \'<div id="authorcommentsmain">\';
echo \'<ul id="authorcomments">\';
echo \'<li>\';
echo \'<a id="authorcommentlink" href="\'.get_comment_link( $c->comment_ID ).\'"> \';
echo get_the_title($c->comment_post_ID);
echo \'</a>\';
echo "</br>";
echo "<div id=\'authorcommentslatest\'><div id=\'authorcommentsuserphoto\'>";
echo userphoto($c->user_id, \'\', \'\', array(id => \'latestcommentsprofile\'));
echo "</div>";
echo "<div id=\'authorcommentexcerpt\'> <p>";
echo my_get_comment_excerpt( $c->comment_ID, 80 );
echo "</p></div></div></li>\\n";
echo \'</ul></div>\';
$comment_meta_args2 = array(
\'status\' => \'approve\',
\'parent\' => intval($parent_comment_id),
\'number\' => 1,
\'user_id\' => 1,
\'order\' => ASC
);
$replies2 = get_comments($comment_meta_args2);
$parent_comment_id = $c->comment_ID;
$comment_meta_args = array(
\'status\' => \'approve\',
\'parent\' => intval($parent_comment_id),
\'number\' => 2,
\'order\' => ASC
);
$replies = get_comments($comment_meta_args);
if ( $replies2)
{
foreach($replies2 as $r2) {
echo \'<div id="authorcommentsmainSPECIAL">\';
echo \'<ul id="authorcommentsSPECIAL">\';
echo \'<li>\';
echo "<div id=\'authorcommentexcerptSPECIAL\'>";
echo "<div id=\'authorcommentsuserphotoSPECIAL\'>";
echo userphoto_thumbnail($r2->user_id, \'\', \'\', array(id => \'latestcommentsprofileSPECIAL\'));
echo "</div>";
echo "<div id=\'authorcommentexcerptSPECIALa\'>" . get_comment_author ($r2->comment_ID) . " says... </div> <div id=\'authorcommentexcerptSPECIALb\'>" . get_comment_excerpt( $r2->comment_ID );
echo "</div></div></li>\\n";
echo \'</ul></div>\';
}
if ( $replies )
{
foreach($replies as $r) {
echo \'<div id="authorcommentsmain2">\';
echo \'<ul id="authorcomments2">\';
echo \'<li>\';
echo "<div id=\'authorcommentexcerpt2\'>";
echo "<div id=\'authorcommentsuserphoto2\'>";
echo userphoto_thumbnail($r->user_id, \'\', \'\', array(id => \'latestcommentsprofile2\'));
echo "</div>";
echo "<div id=\'authorcommentexcerpt2a\'>" . get_comment_author ($r->comment_ID) . " says: </div> <div id=\'authorcommentexcerpt2b\'>" . get_comment_excerpt( $r->comment_ID );
echo "</div></div></li>\\n";
echo \'</ul></div>\';
}
}
}
}
} else { echo "<p style=\'text-align: center\'> Nothing! </p>\\n";} ?>