Using WordPress core function wp_count_posts, you can easily display total number of posts. Here is a simple example on how to use this function:

	$count_posts = wp_count_posts();
	$published_posts = $count_posts->publish;
	echo 'We published ' . $published_posts . ' posts until now, and it's still growing..';

This displays a text output like this;

We published 1908 posts until now, and it's still growing..

With wp_count_posts you also get other counts like drafts, requested posts etc. Here is a sample output showing what wp_count_posts returns as an Object:

stdClass Object
    [publish] => 1908
    [future] => 0
    [draft] => 9
    [pending] => 0
    [private] => 1
    [trash] => 0
    [auto-draft] => 19
    [inherit] => 0
    [request-pending] => 0
    [request-confirmed] => 0
    [request-failed] => 0
    [request-completed] => 0

In your theme, you can use any of those properties to display the number of posts.

Deal Notice: We are using A2 hosting for all of our websites, and we are really happy with their service. So we wanted to share you this discount link for you to try it out. If you get a hosting using this link, you will also help us build better content for you: SSD Hosting - 300% Faster Than Standard Hard Drives