个性化阅读
专注于IT技术分析

通过审核过滤wordpress评论

点击下载

我用它来为我的自定义主题获取wordpress评论:

get_comments( array('status' => 'aprove', 'order' => 'ASC', 'post_id' => $newpost->ID) );

除了不过滤等待审阅的注释之外, 其他所有操作均有效。遵循编解码器:http://codex.wordpress.org/Function_Reference/get_comment’status’=>’approve’应该将其过滤掉, 但这似乎没有发生。

我不是用正确的方法吗?


#1


尝试批准两个P!

get_comments( array('status' => 'approve', 'order' => 'ASC', 'post_id' => $newpost->ID) );

这是get_comments的文档页面(你链接到单数的get_comment。)


#2


这个对我有用。你可以使用以下代码在段落中显示批准的注释。

<?php foreach (get_comments(array('status' => 'approve', 'order' => 'ASC', 'post_id' => $newpost->ID)) as $comment): ?>
<div class="comment-show"><h4><?php echo $comment->comment_author; ?> said: </h4> <p>"<?php echo $comment->comment_content; ?>"</p></div>
<?php endforeach; ?>

我已经在以下网站中使用了显示评论http://rumpa07cse.com/how-to-index-your-website-and-blog-very-quick/

赞(0)
未经允许不得转载:srcmini » 通过审核过滤wordpress评论

评论 抢沙发

评论前必须登录!