Title: query_posts pagination problem
Last modified: August 20, 2016

---

# query_posts pagination problem

 *  Resolved [dtirer](https://wordpress.org/support/users/dtirer/)
 * (@dtirer)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/query_posts-pagination-problem/)
 * So I have a custom template that display posts from a particular category (depending
   on the get_post_meta(‘Category’)).
 * The page works flawlessly for displaying posts from a ‘News’ Category. However,
   using the exact same code (minus how its displayed), it has problems with the
   Pagination for posts from the Calendar Category. Basically, the first page of
   posts display correctly, and then when you hit ‘next page’, the url updates to
   page/2, but the same posts are on the page.
 * Here’s my code: [http://pastebin.com/Zr7TsyNs](http://pastebin.com/Zr7TsyNs)

Viewing 1 replies (of 1 total)

 *  Thread Starter [dtirer](https://wordpress.org/support/users/dtirer/)
 * (@dtirer)
 * [14 years, 7 months ago](https://wordpress.org/support/topic/query_posts-pagination-problem/#post-2308041)
 * i figured it out. Because News is set to my front page, I need to use:
 *  `<?php $paged = (get_query_var('page')) ? get_query_var('page') : 1; ?>`
 * And the Calendar page (or any other) uses:
 *  `<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; ?>`
 * subtle difference 🙂

Viewing 1 replies (of 1 total)

The topic ‘query_posts pagination problem’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [dtirer](https://wordpress.org/support/users/dtirer/)
 * Last activity: [14 years, 7 months ago](https://wordpress.org/support/topic/query_posts-pagination-problem/#post-2308041)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
