Display Number of Posts On WordPress Themes

For WordPress Theme developers who want to display the number of WordPress posts on their themes, there is already a built-in function in WordPress that makes it easy to add stats to your templates. To display the number of posts, just add this code in your templates:

<?php wp_count_posts( $type, $perm ); ?> posts

$type and $perm are optional. You can omit them.

Place the code on the sidebar or the footer to display.