So I hacked together a function that does the following:

protected function _query_post($query){
    $original = $this->_wp_query;
    $wp_query = new WP_Query($query);




        next_posts_link('« Older Entries');
        previous_posts_link('Newer Entries »');

    $wp_query = $original;  

So it's not hard to tell what's going on - all were doing is displaying a list of posts that are queried. The query used here is:

'posts_per_page' => 20

This then created the following page (scroll down) with a a pagination at the bottom.

The problem is, try going through pages 1 - 5. The posts are all the same....At the bottom of the post I do a reset of the query.....

Any ideas?

  • See paginate_links format parameter. – Max Yudin Feb 3 '13 at 20:10
  • That doesnt even come close to answering my question. Did you try out the link? cycle through the various "pages"? see how none of the posts change but the page numbers do? Please be more detailed. – TheWebs Feb 3 '13 at 20:19
  • It is pretty close. You are using pretty permalinks and in the same time you use default format value. Just follow the link. And there is some dirt in your code. adambalan.com/WordPressDev/?page=3 does not redirect to adambalan.com/WordPressDev/page/3, but adambalan.com/WordPressDev/?paged=3 do. – Max Yudin Feb 3 '13 at 20:26
  • I have been reading the link, how ever I am not sure what I need to change. Do you have any examples? – TheWebs Feb 3 '13 at 22:30
  • The pagination is working as expected but the posts dont change when you go to older posts, or page/2 page/3 and so on. – TheWebs Feb 4 '13 at 3:34

do you have the current page number in your $query array?

for example:

$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;

$query = array( 'paged' => $paged );
| improve this answer | |
  • With that now, check out the link,going to page 2, 3, 4 or 5 causes there to be blank and empty pages. – TheWebs Feb 3 '13 at 22:29
  • can you share the $query array you are using? – birgire Feb 3 '13 at 23:25
  • just as simple: 'posts_per_page' => 20 – TheWebs Feb 4 '13 at 0:14
  • and $query=array('posts_per_page' => 20,'paged'=>$paged); gives you empty pages? You could also check out some manual pages: $query=array('posts_per_page' => 20,'paged'=>4); – birgire Feb 4 '13 at 1:01
  • cant do paged=>4 because what if there's more then 4 pages? it gives me empty pages AFTER page one, WITH 'paged' => $paged – TheWebs Feb 4 '13 at 2:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.