Closed HowToSolutions closed 7 years ago
Hi there!
... the information about _statscomments does not mention that the comment will also take into account the time range.
Indeed. That bit has been there since the very first versions of the plugin (when WPP didn't take into account the time range, it just simply returned the total number) and nobody ever said anything about it until now. I just took care of that in WPP 4 :P
At the moment, if I choose monthly interval, the plugin will show number of comments made for that time range. Since the widget is simply named "Popular posts", the visitors get the wrong impression that there are small number of comments on those popular posts.
Here's another point of view: wouldn't it be weird to list the top commented posts of the last hour (something that might be possible with WPP 4) and have WPP display the total comments count of all times instead of the actual comments count those posts got during that time frame? (Same thing applies to views count, by the way.)
At the moment your only alternative -excluding changing plugin's code directly, for maintainability reasons- is to use one of WPP's filter hooks to adapt the output to your needs (like wpp_post.)
Here's an example:
function customize_single_popular_post( $post_html, $p, $instance ){
$num_comments = get_comments_number( $p->id );
if ( $num_comments > 1 ) {
$comments = $num_comments . __(' comments');
} else {
$comments = __('1 comment');
}
$output = '<li><a href="' . get_the_permalink( $p->id ) . '" title="' . esc_attr( $p->title ) . '">' . $p->title . '</a> (' . $num_comments . ')</li>';
return $output;
}
add_filter( 'wpp_post', 'customize_single_popular_post', 10, 3 );
Hi,
This plugin is really great, but there is one option I'm missing. At the moment, if I choose monthly interval, the plugin will show number of comments made for that time range. Since the widget is simply named "Popular posts", the visitors get the wrong impression that there are small number of comments on those popular posts.
I would prefer to display number of all the comments in the posts. At the moment I hardcoded the fix by removing
comment_date_gmt > DATE_SUB
in theWHERE
clause, but having this as an option would be nice.Also, in the parameters tab, the information about _statscomments does not mention that the comment will also take into account the time range. It simply states: