Skip to content

Instantly share code, notes, and snippets.

@chinmayrajyaguru
Last active March 22, 2017 13:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chinmayrajyaguru/e36d6dcda45c52c2f61cd47c3d61e8c9 to your computer and use it in GitHub Desktop.
Save chinmayrajyaguru/e36d6dcda45c52c2f61cd47c3d61e8c9 to your computer and use it in GitHub Desktop.
WordPress Approved Recent Comments with Gavtar
<h3>Recent Comments</h3>
<ul class="recent-comment">
<?php
$comments =get_comments( array('number'=>'5', 'status' => 'approve') );
foreach($comments as $comm) :
$url = '<a href="'. get_permalink($comm->comment_post_ID).'#comment-'.$comm->comment_ID .'" title="'.$comm->comment_author .' | '.get_the_title($comm->comment_post_ID).'">' . $comm->comment_author . '</a>';
?>
<li>
<?php echo get_avatar($comm->comment_author_email, 30); ?>
<strong><?php echo $url; ?></strong>
<p><?php echo $comm->comment_content; ?></p>
</li>
<?php
endforeach;
?>
</ul>
/*
.recent-comment li {
display: block;
border-bottom: 1px dotted #ccc;
}
.recent-comment .avatar-30 {
float: left;
margin-right: 10px;
}
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment