• I love Brian Groce’s “WP Category Posts” plug-in – but I’d love it even more if I was able to display the number of comments for each post along with the title. Does any know how to do this??

    The db query looks like this (i’ve edited it a bit to pull the body of the post as well…

    $get_posts_in_cat = “SELECT $wpdb->posts.ID, $wpdb->posts.post_title, $wpdb->posts.post_content, $wpdb->posts.post_date,”;
    $get_posts_in_cat .= “$wpdb->post2cat.post_id, $wpdb->post2cat.category_id “;
    $get_posts_in_cat .= “FROM $wpdb->posts, $wpdb->post2cat “;
    $get_posts_in_cat .= “WHERE $wpdb->posts.ID = $wpdb->post2cat.post_ID “;
    $get_posts_in_cat .= “AND $wpdb->post2cat.category_id = ‘$catID’ “;
    $get_posts_in_cat .= “AND $wpdb->posts.post_status = ‘publish’ “;
    $get_posts_in_cat .= “ORDER BY $wpdb->posts.post_date DESC”;

    Thanks!! 🙂

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘wp_category_posts – show number of comments?’ is closed to new replies.