[resolved] Showing next page (3 posts)

  1. charlieholder
    Posted 6 years ago #

    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.

  2. charlieholder
    Posted 6 years ago #

    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.


  3. charlieholder
    Posted 6 years ago #

    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 ?>

Topic Closed

This topic has been closed to new replies.

About this Topic