WordPress:Function Reference/get approved comments
来自站长百科
Description
描述
Takes post ID and returns an array of objects that represent comments that have been submitted and approved.
获得文章ID并且返回an array of objects代表已经递交并且审核后的评论。
Usage
用法
<?php $comment_array = get_approved_comments($post_id); ?>
<?php $comment_array = get_approved_comments($post_id); ?>
Example
例子
In this example we will output a simple list of comment IDs and corresponding post IDs.
在这个例子中,我们会输出评论IDs和相应的文章IDs的一个一个简单的列表。
<?php $postID = 1; $comment_array = get_approved_comments(1); foreach($comment_array as $comment){ echo $comment->comment_ID." => ".$comment->comment_post_ID."\n"; } ?>
<?php $postID = 1; $comment_array = get_approved_comments(1); foreach($comment_array as $comment){ echo $comment->comment_ID." => ".$comment->comment_post_ID."\n"; } ?>