Skip to content

Instantly share code, notes, and snippets.

@v9n
Created August 23, 2010 10:03
Show Gist options
  • Save v9n/545177 to your computer and use it in GitHub Desktop.
Save v9n/545177 to your computer and use it in GitHub Desktop.
function axcoto_get_lastest_comments() {
global $wpdb;
$sql = "
SELECT c.comment_ID, c.comment_author, c.user_id, c.comment_content,
p.post_title, p.ID
FROM $wpdb->comments as c
LEFT JOIN $wpdb->posts as p ON p.ID=c.comment_post_ID
WHERE c.comment_approved=1
ORDER BY c.comment_date DESC
LIMIT 5
";
$results = null;
$results = $wpdb->get_results($sql);
wp_reset_query();
return $results;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment