Easy:
function show_portfolio_comments( $post_ID )
{
// NOT approved
$comments_unapproved = get_comments( array( 'status' => 'hold', 'post_id' => $post_ID ) );
foreach ( $comments_unapproved as $comments)
{
if ( current_user_can( 'edit_published_posts' ) // maybe you'll have to switch to some other cap
{
?>
<div class="comment">
<h4>Unapproved Comments on your portfolio</h4>
<div class="comment-author"><?php echo $comment->comment_author; ?></div>
<div class="comment-content"><?php echo $comment->comment_content; ?></div>
</div>
<?php
} // endif; - current_user_can( 'edit_published_posts' )
}
// ALREADY approved
$comments_approved = get_comments( array( 'status' => 'approve', 'post_id' => $post_ID ) );
foreach ( $comments_approved as $comments)
{
?>
<div class="comment">
<?php if ( current_user_can( 'edit_published_post' ) { ?>
<h4>Approved Comments on your portfolio</h4>
<?php } // endif; - current_user_can( 'edit_published_posts' ) ?>
<div class="comment-author"><?php echo $comment->comment_author; ?></div>
<div class="comment-content"><?php echo $comment->comment_content; ?></div>
</div>
<?php
}
}
Template Tag:
// Use it in your template like this & don't forget to push the post ID into it:
$post_ID = $GLOBALS['post']->ID;
// or:
global $post;
$post_ID = $post->ID;
// or:
$post_ID = get_the_ID();
// or:
$post_ID = get_queried_object_id();
show_portfolio_comments( $post_ID );