Quick question I currently have a small bit of code that is pulling comments from a comment box on one page and displaying those comments on another page.
Here is the code that I have on my page.php:
<div id="comments">
<?php if ( is_page('share-your-story')) {
$comments = get_comments('post_id=2583');
foreach($comments as $comm) :
echo "<hr>"."<h3>".($comm->comment_author)."</h3>";
echo "<p>".($comm->comment_content)."</p>";
endforeach;
}
else {
comments_template()开发者_开发技巧;
}
?>
Problem is that the comments are not going through the approval process is there anything to this code that I can add that will stop the comment from displaying automatically?
Thanks, Matt
get_comments
accepts a status parameter. So, get_comments('post_id=2583&status=approve')
will return only approved comments for that post.
精彩评论