WordPress.org

Support

Support » Themes and Templates » [Resolved] Showing next page

[Resolved] Showing next page

  • I’m in the process of building my first theme. I’ve got the index page set, but I cannot figure out how to get the pagination working. The navigational links for older and newer posts render fine. The URLs formatted are domain.tld/page/#. Nothing happens when I click to view older or newer posts. I don’t get why it’s not working.

    Here’s a copy of my main loop on the index page:

    [Code moderated as per the Forum Rules. Please use the pastebin]

    Let me know if I need to give more information to help diagnose.
    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Even though my pasting didn’t fall into either of the categories (i.e. a few lines or the whole template), here’s my pastebin link to an excerpt of my code involving the loop.

    http://wordpress.pastebin.com/3BvXfcTD

    I narrowed it down to this line:
    <?php query_posts('posts_per_page=7&offset=1'); //the query ?>

    Seems to overwrite the main query regardless of what page you’re on. I’ve come up with a solution and here it is:
    <?php global $paged; $offset = (empty($paged)) ? 1 : (($paged-1)*5)+1; query_posts('offset='.$offset); //the query ?>

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Showing next page’ is closed to new replies.