Forums

navigation links not working (3 posts)

  1. clockworkjoe
    Member
    Posted 1 year ago #

    I'm using <?php query_posts ('posts_per_page=4'); ?> to get posts for a custom archive page and <?php posts_nav_link('sep','previous ','next '); ?> to create nav links to page through multiple pages of posts.

    the problem is that I'm not going through the older posts. So if I go to site.com/?page_id=42 it shows posts 8 to posts 5. Then if I click on next to go to site.com/?page_id=42&paged=2 it still shows posts 8 to 5 instead of posts 4 to 1.

    [Please post code snippets between backticks or use the code button]]

  2. alchymyth
    The Sweeper
    Posted 1 year ago #

    you need to include the 'paged' parameter into the query:

    http://codex.wordpress.org/Function_Reference/query_posts#Pagination_Parameters

    try:

    <?php
    query_posts ('posts_per_page=4&paged=' . get_query_var( 'page' ) ); ?>
  3. clockworkjoe
    Member
    Posted 1 year ago #

    It's still only showing the latest 4 posts. here's the full thing.

    http://wordpress.pastebin.com/dJ1qm2QH

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags