Popular Posts – excluding a particular category
-
Hi – I have a popular posts SQL type script running that works well, but I was wondering – can I exclude posts from a particular category?
Here is an excerpt of the current code – I’m a total nooobie at this…
function wp_popular_posts() { global $wpdb; $result = $wpdb->get_results("SELECT comment_count,ID,post_title FROM $wpdb->posts ORDER BY comment_count DESC LIMIT 0 , 5"); foreach ($result as $post) { setup_postdata($post); $postid = $post->ID; $title = $post->post_title; $commentcount = $post->comment_count; if ($commentcount != 0) {
Thanks
- The topic ‘Popular Posts – excluding a particular category’ is closed to new replies.