How to display total number of Custom Posts on a WordPress site

Based on this quick tip from WPRecipes, I was able to quickly figure out how to count and display the number of Custom Posts (of a particular type) that I had on a site. [sourcecode language=”php”] <?php $numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE (post_status = ‘publish’ AND post_type = ‘listing’)"); if (0 < $numposts)… Continue reading How to display total number of Custom Posts on a WordPress site

Published
Categorized as Wordpress