Title: Posts/Comments page counter
Last modified: August 21, 2016

---

# Posts/Comments page counter

 *  [berius](https://wordpress.org/support/users/berius/)
 * (@berius)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/postscomments-page-counter/)
 * I would like to implement [something like this](http://imageshack.us/a/img801/7226/8x0u.png)
   into my theme for blog posts and comments. Is there any tutorial about that ?
   🙂
 * Thx in advance

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

 *  [Jesin A](https://wordpress.org/support/users/jesin/)
 * (@jesin)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/postscomments-page-counter/#post-4081320)
 * There is a function in wordpress called [paginate_links()](https://codex.wordpress.org/Function_Reference/paginate_links)
   is used to do this.
 * And here is the code I use on [my blog](http://jesin.tk) to display page numbers.
 *     ```
       <?php
       global $wp_query;
       $total = $wp_query->max_num_pages;
       if ( $total > 1 )  {
       echo "<div id=\"pagination\">";
       if(!$current_page = get_query_var('paged'))
       $current_page = 1;
       $perma = get_option('permalink_structure');
       $format = empty( $perma ) ? '&page=%#%' : 'page/%#%/';
       echo paginate_links(array(
       'base' => get_pagenum_link(1) . '%_%',
       'format' => $format,
       'current' => $current_page,
       'total' => $total,
       'end_size' => 2,
       'mid_size' => 1,
       'type' => 'list'
       ));
       echo "</div>";
       }
       ?>
       ```
   
 *  Thread Starter [berius](https://wordpress.org/support/users/berius/)
 * (@berius)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/postscomments-page-counter/#post-4081468)
 * thx jesin

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

The topic ‘Posts/Comments page counter’ is closed to new replies.

## Tags

 * [Comments](https://wordpress.org/support/topic-tag/comments/)
 * [posts](https://wordpress.org/support/topic-tag/posts/)

 * 2 replies
 * 2 participants
 * Last reply from: [berius](https://wordpress.org/support/users/berius/)
 * Last activity: [12 years, 9 months ago](https://wordpress.org/support/topic/postscomments-page-counter/#post-4081468)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
