Borderless Mind, The World Without Boundaries

Borderless Mind

The World Without Boundaries



Recent Comment On WordPress

On regulus_wordpress_theme_2:
if (function_exists(‘get_recent_comments’)) { ?>
<h2><? php _e('Recent Comments:'); ?></h2>
<ul>
<?php get_recent_comments(); ?>
</ul>

<?php } ?>

You can see all (most) function in
D:\xampplite\htdocs\ugm\wp-includes\template-functions-general.php
Put this code below on your sidebar.php in your theme that you are using:

<h2>Recent Comment</h2>
<?php $aziz_comment_count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '1'");
echo ''.$aziz_comment_count;
echo ' comment'; ?>
<ul>
<?php
$comments = $wpdb->get_results("SELECT comment_author, comment_author_url, comment_ID, comment_post_ID FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 5");
if ( $comments ) {
foreach ($comments as $comment) {
echo '<br>';
echo '<a xhref="'.$comment->comment_author_url. '">' .$comment->comment_author.'</a>';
echo ' on ';
echo '<a xhref="'.get_permalink($comment->comment_post_ID). '">' .get_the_title($comment->comment_post_ID).'</a>';
echo '<br>';
}
}
?>
</ul>

Note: if you want to change the amount of comment that appear, change the LIMIT 5 in
$comments = $wpdb->get_results("SELECT comment_author, comment_author_url, comment_ID, comment_post_ID FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 5");

January 18th, 2007 | wordpress | no comments

No Comments »



No comments yet.

Leave a comment

:hihi: :hiks: :melet: :nangis: :ngakak: :puyeng: :sip: :sliwer2: more »