Ok i have this code which displays total number of POSTS ( not pages ) published
<?php echo $numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post'"); if (0 < $numposts) $numposts = number_format($numposts); ?>
Now its counting all posts within all categories.
Is there a way to exclude it counting posts within a category name?
Like I have 10 categories on my blog its counting all posts in all 10 categories, but i want it to only count posts in 9 categories, so best way i can think is to code it so that it excludes posts in the 10th category…
So the above code is just for displaying count number of all posts, any ideas?
- The topic ‘How to exclude categories’ is closed to new replies.