views:

74

answers:

1

Hello guys,

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

+1  A: 

get_comments accepts a status parameter. So, get_comments('post_id=2583&status=approve') will return only approved comments for that post.

Richard M
Awesome... thanks!
Matthew