Title: get current post count
Last modified: August 20, 2016

---

# get current post count

 *  [friendlygiraffe](https://wordpress.org/support/users/friendlygiraffe/)
 * (@friendlygiraffe)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/get-current-post-count/)
 * Hi I am using this code on a single page
 *     ```
       $count_posts = wp_count_posts();
       echo ' of '.$count_posts->publish.' drawings.';
       ```
   
 * I want to be able to get the current_post_count. IE: post 2 of 349 post (in that
   category)
 * Is this possible?
 * Thanks

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

 *  [jamesduffell](https://wordpress.org/support/users/jamesduffell/)
 * (@jamesduffell)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/get-current-post-count/#post-2601844)
 * You could use the following script to number posts then if you needed to display‘
   post number X’ of ‘X’ you could use another funtion to get the total count.
 * [http://www.wprecipes.com/how-to-display-an-incrementing-number-next-to-each-published-post](http://www.wprecipes.com/how-to-display-an-incrementing-number-next-to-each-published-post)
 * Hope this helps
    ^JD
 *  Thread Starter [friendlygiraffe](https://wordpress.org/support/users/friendlygiraffe/)
 * (@friendlygiraffe)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/get-current-post-count/#post-2601845)
 * Thanks. That seems to add a number when you publish or create a post, but not
   the sequence number of the post in that particular category
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/get-current-post-count/#post-2601867)
 * as ‘wp_count_posts()’ is not category specific, this might get a bit more complicated.
 * try (assuming an ordinary loop, no custom query or so):
 *     ```
       global $query_string;
       $all_post_query = new WP_Query($query_string.'&posts_per_page=-1');
       $all_posts = $all_post_query->post_count;
       $this_post_nr = 1 + $wp_query->current_post + (get_query_var('paged')?(get_query_var('paged')-1) : 0) * get_option('posts_per_page');
       $count_posts = $all_post_query->post_count;
       echo $this_post_nr.' of '.$count_posts.' drawings.';
       ```
   
 *  Thread Starter [friendlygiraffe](https://wordpress.org/support/users/friendlygiraffe/)
 * (@friendlygiraffe)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/get-current-post-count/#post-2601962)
 * hmmm that stille didn’t work. Here is my code – it’s a single-post template
 * _[[code moderated - please use the pastebin for any code over the forum limit of 10 lines]](http://codex.wordpress.org/Forum_Welcome#Posting_Code)_

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

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

 * 4 replies
 * 3 participants
 * Last reply from: [friendlygiraffe](https://wordpress.org/support/users/friendlygiraffe/)
 * Last activity: [14 years, 2 months ago](https://wordpress.org/support/topic/get-current-post-count/#post-2601962)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
