Title: Using post count
Last modified: August 19, 2016

---

# Using post count

 *  Resolved [Gilnaa](https://wordpress.org/support/users/gilnaa/)
 * (@gilnaa)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/using-post-count/)
 * I’m trying to put a post counter at the header template:
    `<h5><?php wp_count_posts('
   post', '')->publish; ?> uses</h5>` But it doesn’t work (Shows only “uses”)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/using-post-count/#post-2024568)
 * try and add an `echo` to your code; `wp_count_posts()` only returns the value,
   but does not put it out:
 * `<h5><?php echo wp_count_posts('post', '')->publish; ?> uses</h5>`
 * [http://codex.wordpress.org/Function_Reference/wp_count_posts](http://codex.wordpress.org/Function_Reference/wp_count_posts)
 *  Thread Starter [Gilnaa](https://wordpress.org/support/users/gilnaa/)
 * (@gilnaa)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/using-post-count/#post-2024569)
 * Thank you 🙂
    It works!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Using post count’ is closed to new replies.

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 2 replies
 * 2 participants
 * Last reply from: [Gilnaa](https://wordpress.org/support/users/gilnaa/)
 * Last activity: [15 years, 2 months ago](https://wordpress.org/support/topic/using-post-count/#post-2024569)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
