Title: paginate_links
Last modified: August 21, 2016

---

# paginate_links

 *  [john_harrison](https://wordpress.org/support/users/john_harrison/)
 * (@john_harrison)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/paginate_links/)
 * Hi All –
 * So I’m using this for pagination:
 *     ```
       function html5wp_pagination()
       {
           global $wp_query;
           $big = 999999999;
           echo paginate_links(array(
               'base' => str_replace($big, '%#%', get_pagenum_link($big)),
               'format' => '?paged=%#%',
               'current' => max(1, get_query_var('paged')),
               'total' => $wp_query->max_num_pages
           ));
       }
       ```
   
 * The only problem is that this creates an empty pagination div if there is no 
   pagination. Is there an if argument I can use to not output the pagination div
   if there is no pagination?
 * Thanks
    John

Viewing 1 replies (of 1 total)

 *  Thread Starter [john_harrison](https://wordpress.org/support/users/john_harrison/)
 * (@john_harrison)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/paginate_links/#post-4004959)
 * Got my answer…
 * If anyone was wondering, just use this:
 *     ```
       <?php 
   
            global $paginated_query;
            global $wp_query;
   
            if ( !$paginated_query ):
             $paginated_query = $wp_query;
            endif;
   
            if ( $paginated_query->max_num_pages > 1 ) : ?>
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘paginate_links’ is closed to new replies.

## Tags

 * [paginate_links](https://wordpress.org/support/topic-tag/paginate_links/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [john_harrison](https://wordpress.org/support/users/john_harrison/)
 * Last activity: [12 years, 9 months ago](https://wordpress.org/support/topic/paginate_links/#post-4004959)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
