Return to Snippet

Revision: 25847
at April 12, 2010 05:11 by howardpanton


Initial Code
<?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'");
	if (0 < $numposts) $numposts = number_format($numposts); 
	
	$numcomms = $wpdb->get_var("SELECT COUNT(1) FROM $wpdb->comments WHERE comment_approved = '1'");
	if (0 < $numcomms) $numcomms = number_format($numcomms);
	
	$numcats = count(get_all_category_ids());
?>

Initial URL

                                

Initial Description
Count the number of comments in wordpress blog

Initial Title
Wordpress Comment counts

Initial Tags
wordpress

Initial Language
PHP