WordPress.org

Forums

Next/Previous Not Working - Not a general settings issue. (3 posts)

  1. Dirt2
    Member
    Posted 5 years ago #

    I'm using this for my site so it only gets posts to display on my index that are in a certain category.

    <?php query_posts('cat=3'); if ( have_posts() ) : while ( have_posts() ) : the_post()?>

    Now my pagination doesn't work and I don't know of a way to fix this, I looked up this but it only caused php errors. http://www.rizwanashraf.com/2009/01/24/wordpress-nextprevious-page-links-problem-query_post-pagination-problem/

    Also my general settings have the correct URL (it's on the root plus it's not a 404 error) - I've looked up this issue and can't find any related answers.

    When you click next/previous pages it shows the current ones that are already visible on every page so it doesn't display new ones on either page, just the same 20ish or so on every page.

    Please help! Thank you very much

  2. stvwlf
    Member
    Posted 5 years ago #

    Hi

    change your code to this - should take care of it

    <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
       query_posts("cat=3&paged=$paged");
       if ( have_posts() ) : while ( have_posts() ) : the_post()?>
  3. Dirt2
    Member
    Posted 5 years ago #

    You're a great help, Thank you so much. It looks similar to the link I had provided but I knew it couldn't be correct but didn't know how to fix it! Thank you thank you.

Topic Closed

This topic has been closed to new replies.

About this Topic