Support » Fixing WordPress » Pagination Issue Using query_posts

  • Resolved JRiley21


    Hi all. ๐Ÿ™‚

    Ok, so I’ve spent all day looking at how to fix my pagination issue. Basically, when I click on ‘older’ or ‘newer’ posts, it just displays the first page again.

    I got a decent understanding of the issue with this thread: Here (Tried the suggestions, still didn’t work).

    I also gave this a shot: Here (Also didn’t work).

    Here’s the code I’m using in that section: Here

    Can someone help me adjust this code so that the pagination works correctly!? This has been a major headache.

    Thanks! ๐Ÿ™‚

Viewing 4 replies - 1 through 4 (of 4 total)
  • At the very least, this line

    <?php query_posts('cat=1&showposts=5'); ?>

    should be

    <?php query_posts('cat=1&showposts=5&paged=' . $paged); ?>

    Michael – That’s exactly what I needed, thanks a TON! You’re a life saver. ๐Ÿ™‚

    what php page are you pasting this code at? I have the classipress theme and clicking on page 2 changes the url but not the results and wanted to know where this code goes at.

    ive tried that and i cant override my default settings. the first page displays correctly, but when you click next page it shows the remaining posts and not the post limit i set. and in the title of the browser it says “pages not found”. i have googled and googled and searched and read many others solutions. which none of them fix my issue. could you please tell me what i might be leaving out. here is my code –

    <strong><?php get_header();  ?> 
    <?php get_sidebar(); ?>  
    <?php query_posts('cat=3&showposts=2&paged=' . $paged); ?>
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    	<div class="recent-news">
    	<div class="post-thumbnail">
    	<?php the_post_thumbnail(); ?>
    	</div><!--end post-thumbnail-->
    	<div class="latest-news">
    	<div class="post-title"><h2><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2></div>
    		<p><?php $excerpt = get_the_excerpt(); echo string_limit_words($excerpt,40); ?>... <a href="<?php the_permalink(); ?>">Read More</a></p>
    		 <div class="datetime"><?php the_author(); ?> - <?php the_time('l, F j, Y G:i'); ?> <?php comments_popup_link('No Comments ยป', '1 Comment ยป', '% Comments ยป'); ?></div>
    		</div><!--end latest-news-->
    	</div><!--end recent-->
    <?php comments_template(); // Get wp-comments.php template ?>
    <?php endwhile; else: 
    <p>Sorry, no posts we're found.</p>
    <?php endif; ?>
    <div class="clearfloat"></div>
    <div id="post-nav"><p align="center"><?php posts_nav_link(); ?></p></div><!--end post-nav-->
    </div><!--end wrapper-->
    <?php get_footer(); ?></strong>

    Thanks in advance for any help!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Pagination Issue Using query_posts’ is closed to new replies.