• Resolved tomboersma

    (@tomboersma)


    Hi,

    I’m making a website here for a local history-club: https://www.aurlandsogelag.no/

    On the artiklar page (articles) I can’t get the page navigation to work: it seems to point to the correct page/2 and page/3 but always just shows the first 5 posts. I’ve studied the forums but didn’t find a solution.

    The page is a template “artiklar.php” where I select the articles by using this code:

    <?php query_posts(‘cat=4’);?>

    Can anybody help? Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Codex ? query posts ? Usage:

    When you do this, WordPress ignores the other parameters it receives via the URL (such as page number or category). If you want to preserve that information, you can use the variable $query_string in the call to query_posts().

    So need $query_string to preserve the paging info.

    <?php query_posts($query_string . '&cat=4');?>

    Thread Starter tomboersma

    (@tomboersma)

    Thanks for your fast help. Unfortunately it doesn’t work: No articles are shown at all now…

    Oops. That was a Page template.

    Then you need to empty pagename and page_id params otherwise WP looks for a page named ‘artiklar’ and in category 4, which obviously doesn’t exist.

    <?php query_posts($query_string . '&cat=4&pagename=&page_id='); ?>
    Thread Starter tomboersma

    (@tomboersma)

    That works, thanks a lot!

    Just what I was looking for, thanks !

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘previous/next page don’t work’ is closed to new replies.