Posted by KaiseRCrazY on 21st January 2010
Most Recent Comments! Without Any Plugin
We use plugin/widget for show most recent comments. But we can do that with a simple code. This code gives you simple recent comments feature without plugin. also with gravatar support. Paste this code into your theme where you want. All done!
Here is the code;
<?php
$query = "SELECT * from $wpdb->comments WHERE comment_approved= '1'
ORDER BY comment_date DESC LIMIT 0 ,5";
$comments = $wpdb->get_results($query);
if ($comments) {
echo '<ul>';
foreach ($comments as $comment) {
$url = '<a href="'. get_permalink($comment->comment_post_ID).'#comment-'.$comment->comment_ID .'" title="'.$comment->comment_author .' | '.get_the_title($comment->comment_post_ID).'">';
echo '<li>';
echo '<div class="img">';
echo $url;
echo get_avatar( $comment->comment_author_email, $img_w);
echo '</a></div>';
echo '<div class="txt">Par: ';
echo $url;
echo $comment->comment_author;
echo '</a></div>';
echo '</li>';
}
echo '</ul>';
}
?>
This code shows 5 recent comment. If you change “5” in line two, you can display more comment or less…
This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.
-
Categories
Colored Tags
spiders single.php style.css code Wordpress posts content javascript site theme function robots time else article RSS Google author feed sidebar template Facebook categories if css funcitons category image blog title comment post mysql comments.php Widget comments index.php Functions plugin hide Yahoo functions.php no-index Loop header.phpRecent Comments
Archives
Blogroll
Google Ads















Made by Symmetric Web
Distributed by Smashing Magazine
No comments yet!