[resolved] pagination problems (4 posts)

  1. gillsans
    Posted 7 years ago #

    I'm having issues with my navigation (pagination) not function correctly. When I use Next or Prev it displays the same posts.
    I'm hoping to query posts from 2 categories (3,4) and display them.

    Here is the code:

    <!-- Start the Loop. -->
    <?php query_posts('showposts=4') ?>
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <div class="post">
    <!-- Display the Title as a link to the Post's permalink. -->
    <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
    <!-- Display the Time. -->
    <strong style="margin-bottom:5px;"><small><?php the_time('F jS, Y'); ?></small></strong>
    <!-- Display the Post's Content in a div box. -->
    <div class="entry">
    <?php the_excerpt(); ?>
    <!-- Display a comma separated list of the Post's Categories. -->
    <p class="postmetadata"><?php the_tags('Tags: ', ', ', ''); ?> Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?>  <?php  comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?>Posted by <?php the_author() ?> on <?php the_time('F jS, Y') ?>
    <div class="hr"></div>
    </div><!-- closes the first div box -->
    <!-- Stop The Loop (but note the "else:" - see next line). -->
    <?php endwhile; else: ?>
    <!-- The very first "if" tested to see if there were any Posts to -->
    <!-- display.  This "else" part tells what do if there weren't any. -->
    Sorry, no posts matched your criteria.
    <!-- REALLY stop The Loop. -->
    <?php endif; ?>
    <div class="navigation">
    <div class="alignleft"><?php next_posts_link('&laquo; Older Entries') ?></div>
    <div class="alignright"><?php previous_posts_link('Newer Entries &raquo;') ?></div>
  2. gillsans
    Posted 7 years ago #

    Anyone seen any pagination issues like this?

  3. Xerotone
    Posted 7 years ago #

    I think this is a query_posts problem; you need to specify the $paged parameter or something like that. Look around, there are tips for this. (I haven't fixed my problem but my query is much more complex...)

  4. gillsans
    Posted 7 years ago #

    Thanks, it was in fact the $paged parameter.


Topic Closed

This topic has been closed to new replies.

About this Topic