• Hi all,

    I want to show the comments users make per day. So let’s say I have a post, which I have written ten days ago… I want to show both the total amount of comments, but also, how much comments they have made today. So if they made 10 comments today, that has to be shown. The next day, this amount will be gone…

    How can I pull this off?

Viewing 1 replies (of 1 total)
  • You could do a custom MySQL query based on the current post’s ID:

    $comments_today =
    	$wpdb->get_var(
    		"SELECT count(*)
    		 FROM $wpdb->comments
    		 WHERE $wpdb->comments.comment_post_ID = ".$post->ID."
    		 AND DATE($wpdb->comments.comment_date) = CURDATE() "
            );
    
    echo $comments_today;
Viewing 1 replies (of 1 total)
  • The topic ‘How to display amount of comments per day?’ is closed to new replies.