通过审核过滤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/

来源:

https://www.srcmini02.com/66997.html

微信公众号
手机浏览(小程序)

Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(): Failed to enable crypto in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57

Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_36991.jpg): failed to open stream: operation failed in /mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line 57
0
分享到:
没有账号? 忘记密码?