Showing Wrong Number of Posts
-
The theme I’m using is showing a post count of 39 when it should be 18. Weird.
Here’s the site: http://www.marketingmeasure.com
Here’s the code:
<?php
$numposts = $wpdb->get_var(“SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = ‘publish'”);
if (0 < $numposts) $numposts = number_format($numposts);$numcmnts = $wpdb->get_var(“SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = ‘1’”);
if (0 < $numcmnts) $numcmnts = number_format($numcmnts);
?>
*********************************************************Obviously the code is seeing something incorrectly. Any takers??
***********************************************Update: I counted and I have 18 posts and 21 pages, hence the 39!
So how do I get this code to recognize only the posts?
The topic ‘Showing Wrong Number of Posts’ is closed to new replies.