Title: wp_link_pages_args &#8211; Question
Last modified: September 1, 2016

---

# wp_link_pages_args – Question

 *  [fk59](https://wordpress.org/support/users/fk59/)
 * (@fk59)
 * [10 years ago](https://wordpress.org/support/topic/wp_link_pages_args-question/)
 * Hi,
 * someone here who can help me with this little problem?
 * I need to expand the following code. I need to show the total number of pages(
   like …10) in the pagination.
 *     ```
       add_filter('wp_link_pages_args', 'wp_link_pages_args_prevnext_add');
       /**
        * Add prev and next links to a numbered link list
        */
       function wp_link_pages_args_prevnext_add($args)
       {
           global $page, $pages, $numpages, $more, $pagenow;
   
           if (!$args['next_or_number'] == 'next_and_number')
               return $args; # exit early
   
           $args['next_or_number'] = 'number'; # keep numbering for the main part
           if (!$more)
               return $args; # exit early
   
           if($page-1) # there is a previous page
               $args['before'] .= _wp_link_page($page-1)
               . $args['link_before']. $args['previouspagelink'] . $args['link_after'] . '</a>'
           ;
   
           if ($page<$numpages) # there is a next page
               $args['after'] = _wp_link_page($page+1)
               . $args['link_before'] . $args['nextpagelink'] . $args['link_after'] . '</a>'
               . $args['after']
           ;
           return $args;
       }
       ```
   
 * Thx very much, Frank

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

 *  Moderator [Jose Castaneda](https://wordpress.org/support/users/jcastaneda/)
 * (@jcastaneda)
 * THEME COFFEE MONKEY
 * [10 years ago](https://wordpress.org/support/topic/wp_link_pages_args-question/#post-7704549)
 * Hi Frank!
 * >  I need to show the total number of pages
 * The `$numpages` global variable stores that. The codex pages also lists off other
   variables and their information: [https://codex.wordpress.org/Global_Variables](https://codex.wordpress.org/Global_Variables)
 * Hope that helps!
 *  Thread Starter [fk59](https://wordpress.org/support/users/fk59/)
 * (@fk59)
 * [10 years ago](https://wordpress.org/support/topic/wp_link_pages_args-question/#post-7704604)
 * yes i know. But i dont get it displayed in the pagination.
 * Perhaps i need some entrys in page.php or css?
 * Thx, Frank

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

 The topic ‘wp_link_pages_args – Question’ is closed to new replies.

## Tags

 * [code](https://wordpress.org/support/topic-tag/code/)
 * [pagination](https://wordpress.org/support/topic-tag/pagination/)
 * [wp_link_pages](https://wordpress.org/support/topic-tag/wp_link_pages/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [fk59](https://wordpress.org/support/users/fk59/)
 * Last activity: [10 years ago](https://wordpress.org/support/topic/wp_link_pages_args-question/#post-7704604)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
