Month: July 2010

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

27 Jul 2010

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)…

Read More