WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Previous entries doesn't work when doing custom query? (3 posts)

  1. westondeboer
    Member
    Posted 6 years ago #

    I am just doing:

    <?php query_posts("cat=1");?>
    <?php next_posts_link('&laquo; Previous Entries') ?>
    <?php previous_posts_link('Next Entries &raquo;') ?>

    And when i go to page 2, it shows the same first 20 posts on the first page.

    How do i do previous and next links when only showing one category on the Main page?

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    Use this instead:
    <?php query_posts($query_string."&cat=1");?>

    By leaving out the query_string, you're ignoring all the variables being set by the system. Such as which page number you're viewing, among others.

  3. westondeboer
    Member
    Posted 6 years ago #

    That was it! Thanks a bunch!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.