WordPress Snippets at WPcustoms

Show total post count in template

Use this snippet in your template to show the total post count. Check out the example below to display custom post type post counts.


/**
 * Snippet Name: Show total post count in template
 * Snippet URL: http://www.wpcustoms.net/snippets/show-total-post-count-template/
 */
 echo 'Total' . wp_count_posts()->publish . ' posts and counting!';

// use this for custom post type counts
// wp_count_posts('movies')->publish