WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Next Previous navigation problem (7 posts)

  1. rjoshicool
    Member
    Posted 5 years ago #

    In my wordpress theme, whenever I click on the Next or Previous button, I get the same entries on each page. I am using this piece of code for getting the posts -

    \\ <?php query_posts('cat=13,14,15,16,17,18,22&showposts=5'); ?>
    \\ <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    \\
    \\ <div class="post" id="post-<?php the_ID(); ?>">

    How can i get this problem solved?

  2. Murmatron 2
    Member
    Posted 5 years ago #

    Your code is ignoring the existing query_string. Try:
    query_posts($query_string . '&cat=13,14,15,16,17,18,22&showposts=5');

  3. rjoshicool
    Member
    Posted 5 years ago #

    i am not using any query_string yet.. Tried this but not working..

  4. t3ch33
    Member
    Posted 5 years ago #

    What Murmatron 2 means is that in this part of your code: <?php query_posts('cat=13,14,15,16,17,18,22&showposts=5'); ?>

    you should remove the part that says showposts=5. You are telling WP that you only want to show 5 posts. I had this problem recently and had to remove it from the index page. You can go to wp-admin/options-reading.php to change "Blog pages show at most" to 5. That worked for me.

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

    ...

    No, t3ch33, Murmatron 2 didn't mean anything of the sort. He said exactly what he meant.

    Change this code:
    <?php query_posts('cat=13,14,15,16,17,18,22&showposts=5'); ?>

    To this:
    <?php query_posts($query_string.'&cat=13,14,15,16,17,18,22&showposts=5'); ?>

    Problem solved.

  6. rjoshicool
    Member
    Posted 5 years ago #

    thank you all for your comments and help.
    Finally i got the problem solved.
    I had to remove that showposts thing from my code and add an extra paged variable.

  7. sebastianpatane
    Member
    Posted 5 years ago #

    had the same problem,
    thanks for the solution!

Topic Closed

This topic has been closed to new replies.

About this Topic