Created
February 8, 2021 14:10
-
-
Save wpmu-authors/18b469efacd0a8461c54d1919abb708e to your computer and use it in GitHub Desktop.
commentcount.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global $wpdb; | |
for( $i=1; $i <= 5; $i++ ) { | |
$this_week = 7 * $i; | |
$last_week = 7 * ( $i - 1); | |
$comment_counts[] = | |
$wpdb->get_var( "SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_date > '" . date('Y-m-d H:i:s', strtotime('-' . $this_week . ' days')) . "' AND comment_date < '" . date('Y-m-d H:i:s', strtotime('-' . $last_week . ' days')) . "'" ) ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment