0

Our wordpress sites have many many users, each of them have an blog account, they can write posts,comments and so on.

Now I want to find out the top 10 popular blogs, according to or order by comments, or blog visite number, or manybe some other stands.

Yes, I can find out the most 10 comments of the posts, but can I get the blogs? A litter difficult.

Anyone could you please show me some ideas, thanks in advanced.

4
  • Can you be more precise please? Is is a multisite installation?
    – JMau
    Commented Jul 1, 2013 at 8:43
  • @JMa No, I just install one wordpress, but I create many many user in wp_users, they using their own username add password logon the system, and writes posts ...
    – diligent
    Commented Jul 1, 2013 at 8:47
  • ok so you just need to know popular posts which is not difficult.
    – JMau
    Commented Jul 1, 2013 at 8:54
  • @JMa thanks man, not popular posts, get the popular posts is easy, I want to get the popular blog, for example, even one of blogger's post is popular, but his blog may not
    – diligent
    Commented Jul 1, 2013 at 9:03

1 Answer 1

1

If I understand you correctly, something like this should help you.

global $wpdb;
$results = $wpdb->get_results( "SELECT post_author, SUM(comment_count) as comments FROM {$wpdb->posts} WHERE post_type='post' AND post_status='publish' GROUP BY post_author ORDER BY comments DESC LIMIT 10");

This will return you 10 authors of most commented posts (with highest sum of comments count of each post they have written).

I'm not sure if this is what you wanted though.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.