category wise popular posts
-
Hi,
I am looking for a code/plugin to show popular posts for that particular category.
eg : blogs.mysite.com/announcement/ sidebar should show most commented posts in announcements alone.
and blogs.mysite.com/general/ sidebar should show most commented post for general category alone.Now I am using this code to show.
<li><h3>Popular Posts</h3> <ul class="bullets"> <?php $popular_posts = $wpdb->get_results("SELECT id,post_title,comment_count FROM {$wpdb->prefix}posts where guid like '%crm%' ORDER BY comment_count DESC LIMIT 0,10"); foreach($popular_posts as $post) { print "<li><a href='". get_permalink($post->id) ."'>".$post->post_title."</a>(<a href='". get_permalink($post->id) ."'>".$post->comment_count."</a>)</li>\n"; } ?> </ul> </li>
but it takes all the posts that contains “crm” in their GUID link.
I just want to know how to add category ID in the qry I used above ?
I tried to search for it. but nothing meets my requerment.
- The topic ‘category wise popular posts’ is closed to new replies.