/ Published in: PHP
Count the number of comments in wordpress blog
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php /* Counts the posts, comments and categories on your blog */ $numposts = $wpdb->get_var("SELECT COUNT(1) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type != 'page'"); $numcomms = $wpdb->get_var("SELECT COUNT(1) FROM $wpdb->comments WHERE comment_approved = '1'"); ?>