cabrerahector / wordpress-popular-posts

WordPress Popular Posts - A highly customizable WordPress widget that displays your most popular posts.
https://wordpress.org/plugins/wordpress-popular-posts/
GNU General Public License v2.0
280 stars 82 forks source link

How to display total approved comments count? #299

Closed dr1361teh closed 2 years ago

dr1361teh commented 2 years ago

Hello, I use the following code to show the popular post ordered by number of comments :

<?php if ( function_exists('wpp_get_mostpopular') ) { wpp_get_mostpopular(array( 'range' => 'weekly', 'stats_comments' => 1, 'order_by' => 'comments', 'limit' => 10 )); } ?>

What should I do to show the total approved comments count and ignore the date range for weekly most commented posts ? Thanks

cabrerahector commented 2 years ago

Hi @dr1361teh,

The code you're using will display the total number of comments received within the last 7 days. The plugin doesn't offer a way to display total comments count.

If you want to display the total comments count then you'll need to create a custom Content Tag, like {total_comments} for example, and then modify the HTML output of the function so it displays this new tag instead of the default one. Check the following links for more details:

If you have any questions don't hesitate to ask.