Here's how you add comments to the Sideblog plugin for Wordpress by Kates Gasis. This diff will only work for Version 3.8.
145c145
< $sideblog_contents = $wpdb->get_results("SELECT $wpdb->posts.ID, $wpdb->posts.post_title, $wpdb->posts.post_content, $wpdb->posts.post_date FROM $wpdb->posts, $wpdb->post2cat WHERE $wpdb->posts.ID = $wpdb->post2cat.post_id AND $wpdb->post2cat.category_id = $asidecategory AND $wpdb->posts.post_status ='publish' AND $wpdb->posts.post_type = 'post' AND $wpdb->posts.post_password ='' AND $wpdb->posts.post_date < '" . $now . "' ORDER BY $wpdb->posts.post_date DESC LIMIT " . $limit);
---
> $sideblog_contents = $wpdb->get_results("SELECT $wpdb->posts.ID, $wpdb->posts.post_title, $wpdb->posts.post_content, $wpdb->posts.post_date, $wpdb->posts.comment_count FROM $wpdb->posts, $wpdb->post2cat WHERE $wpdb->posts.ID = $wpdb->post2cat.post_id AND $wpdb->post2cat.category_id = $asidecategory AND $wpdb->posts.post_status ='publish' AND $wpdb->posts.post_type = 'post' AND $wpdb->posts.post_password ='' AND $wpdb->posts.post_date < '" . $now . "' ORDER BY $wpdb->posts.post_date DESC LIMIT " . $limit);
153a154
> $patterns[] = "%comments%";
173c174,175
< $replacements[] = $excerpt2;
---
> //$replacements[] = $excerpt2;
> $replacements[] = $sideblog_content->comment_count . " comment" . ($sideblog_content->comment_count == 1 ? null : "s");
No comments:
Post a Comment