Title: Total pages error
Last modified: August 20, 2016

---

# Total pages error

 *  [poco06](https://wordpress.org/support/users/poco06/)
 * (@poco06)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/total-pages-error/)
 * Hello,
    I have an issue with the total pages in my blog. I have 19 articles and
   the total pages is 19 (and I have set the number of posts per page to 5, so normally,
   total pages should be 5 max!). I tried pagenavi and pagebar plugins but got the
   same error each time! Is there anything to do to change that? Many thanks

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

 *  [Krishna](https://wordpress.org/support/users/1nexus/)
 * (@1nexus)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/total-pages-error/#post-3105485)
 * Site URL?
 *  Thread Starter [poco06](https://wordpress.org/support/users/poco06/)
 * (@poco06)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/total-pages-error/#post-3105487)
 * [http://www.commerceprospere.com](http://www.commerceprospere.com)
 * Regards
 *  [Krishna](https://wordpress.org/support/users/1nexus/)
 * (@1nexus)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/total-pages-error/#post-3105488)
 * Looks like a problem created by your theme (or a plugin, possibly). Can you revert
   to Twenty Eleven theme and see if the problem still persists? You can put back
   your theme afterwards.
 *  Thread Starter [poco06](https://wordpress.org/support/users/poco06/)
 * (@poco06)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/total-pages-error/#post-3105489)
 * Hi Krishna,
 * I have replaced Gantry theme by Twenty Eleven and it’s working fine. In order
   to make pagebar working, I modified the file : wp-content/themes/rt_gantry_wp/
   html/home.php as follow :
 * Initial value :
 * _[ Moderator Note: Please post code or markup snippets between backticks or use
   the code button. ]_
 *     ```
       <!-- Begin Navigation -->
   
       				<?php if($custom_query->max_num_pages > 1) : ?>
   
       				<div class="rt-pagination nav">
       					<div class="alignleft">
       						<?php next_posts_link('« '._r('Older Entries'), $custom_query->max_num_pages); ?>
       					</div>
       					<div class="alignright">
       						<?php previous_posts_link(_r('Newer Entries').' »', $custom_query->max_num_pages) ?>
       					</div>
       					<div class="clear"></div>
       				</div>
   
       				<?php endif; ?>
   
       				<!-- End Navigation -->
       ```
   
 * Modified by :
 *     ```
       <!-- Begin Navigation partie modifiée pour intégrer pagenavi -->
   
       				<?php if($custom_query->max_num_pages > 1) : ?>
   
       				<div class="rt-pagination nav">
       					<?php pagebar(); ?>
       					<div class="clear"></div>
       				</div>
   
       				<?php endif; ?>
   
       				<!-- End Navigation -->
       ```
   
 * Regards
 *  [Krishna](https://wordpress.org/support/users/1nexus/)
 * (@1nexus)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/total-pages-error/#post-3105497)
 * It looks OK.
 * While posting code, please use the code button or use `backticks`.
 *  Thread Starter [poco06](https://wordpress.org/support/users/poco06/)
 * (@poco06)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/total-pages-error/#post-3105502)
 * OK Krishna,
 * Unfortunately, this is not solving my issue as when I switch to Gantry again,
   the same problem is coming back.
    Regards
 *  Thread Starter [poco06](https://wordpress.org/support/users/poco06/)
 * (@poco06)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/total-pages-error/#post-3105580)
 * Hello,
    Is there a way to find where the max_pages variable is defined? Many 
   thanks
 *  Moderator [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * (@keesiemeijer)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/total-pages-error/#post-3105581)
 * Do you have a query on the main loop?
    [http://codex.wordpress.org/Pagination#Troubleshooting_Broken_Pagination](http://codex.wordpress.org/Pagination#Troubleshooting_Broken_Pagination)
 *  Thread Starter [poco06](https://wordpress.org/support/users/poco06/)
 * (@poco06)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/total-pages-error/#post-3105584)
 * Hello,
    I have no issue with redirected links. In fact, it seems that the “total_pages”
   is equal to “total_posts” in my case. If I set the number of post per page to
   1, then, pagebar is working correctly! Regards

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

The topic ‘Total pages error’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 9 replies
 * 3 participants
 * Last reply from: [poco06](https://wordpress.org/support/users/poco06/)
 * Last activity: [13 years, 7 months ago](https://wordpress.org/support/topic/total-pages-error/#post-3105584)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
