• Here is my custom page;

    <?php query_posts($query_string . '&post_type=post'); ?>
    
    <?php get_template_part( 'loop', 'index' ); ?>

    …and in my loop.php I’ve just got the standard pagination code;

    <?php if ( $wp_query->max_num_pages > 1 ) : ?>
    		<?php next_posts_link( __( '&larr; Older posts', 'twentyten' ) ); ?>
    		<?php previous_posts_link( __( 'Newer posts &rarr;', 'twentyten' ) ); ?>
    <?php endif; ?>

    Yet on this page, when I click on ‘Older posts’ it takes me to http://www.website.com/article-name/2/ but the pagination links are exactly the same (as if I was still on the 1st page). The blog posts have changed though.

    For the standard blog page the pagination links work fine.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Try:

    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts($query_string . '&post_type=post&paged='. $paged'); ?
    ?>

    Thread Starter wmboy

    (@wmboy)

    Many thanks for your response. I assume you meant this (the code above was invalid);

    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts($query_string . '&post_type=post&paged='. $paged . '');
    ?>

    That doesn’t work unfortunately. In fact it’s worse than before as page 2 now displays the same posts as page 1 (as well as still not showing a ‘Newer posts’ link on page 2).

    Any further suggestions?

    Thread Starter wmboy

    (@wmboy)

    Can I assume then that pagination isn’t supposed to work on standard pages (only the blog index and category pages…)?

    You only get auto-pagination on post listing pages – not on static WP Pages. On the latter, you add a manual <!-- nextpage--> tag to break a large page up into multiple smaller sections.

    Thread Starter wmboy

    (@wmboy)

    Hmmm, can I convert a static page into a post listing page?

    I already have category pages, and a blog page, and I am looking to customize the home page so that it acts as the normal blog page does (with pagination) but has additional home page content on it…).

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘pagination (e.g. next_post_links) doesn't work on page of posts’ is closed to new replies.