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: https://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 

0 0 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x