Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question
    
Can you be more precise please? Is is a multisite installation? –  JMau Jul 1 '13 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 Jul 1 '13 at 8:47
    
ok so you just need to know popular posts which is not difficult. –  JMau Jul 1 '13 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 Jul 1 '13 at 9:03
add comment

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer
    
:) thanks man, that's it. –  diligent Jul 1 '13 at 14:04
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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