• Hi everyone,

    I know there are plenty of plugins for “recent comments” and so, but I’m trying a new approach in order to get some meta widely customisable.

    Here is what I have in mind :
    – each comment as a numeric ID, which you can get using <?php comment_ID() ?>
    – each new comment gets an ID + 1 (with respect to the one before).
    – the total amount of comments can easily be found using this bit of code :

    function number_of_comments () {
          global $wpdb;
          $count = "SELECT COUNT(*) FROM $wpdb -> comments WHERE comment_approved='1' ";
          echo $wpdb -> get_var ($count) ;

    Ok, so logically, it should be possible to get each of the 5 newest comments by computing : [number_of_comments] -1 , … , -5

    And that’s about where I’m lost…. How do we do ?!

    I sincerely hope you’ll help me out !

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Recent Comments – a new approach’ is closed to new replies.