WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Each paginated page shows the same posts (4 posts)

  1. iheartlolcats
    Member
    Posted 4 years ago #

    Each of my paginated pages show the same most recent posts as on the homepage, I can't see my older entries. I did just update wordpress but I'm not sure if that's why.. here's my theme file:

    <?php
    /**
     * @package WordPress
     * @subpackage WP_Theme
     */
    
    get_header(); ?>
    <div class="post">
    
    	<?php
    	rewind_posts();
    	query_posts(
    	array (
    		'cat' => 1,
    		//'posts_per_page' => 3,
    		)
    	); // blog
    	?>
    		<h1>Blog</h1>
    		<div class="entry">
    	<?php if (have_posts()) : ?>
    
    		<?php while (have_posts()) : the_post(); ?><div class="inner-entry">
    	<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
    	<small><?php the_time('F jS, Y') ?></small>
    		<?php the_content('...>'); ?>
    		</div>
    		<?php endwhile; ?>
    		<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></div>
    	<?php else : ?>
    		<h2>Not Found</h2>
    		<div class="inner-entry">
    			<p>Sorry, but you are looking for something that isn't here.</p>
    		</div>
    	<?php endif; ?>
    </div></div>
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>
  2. esmi
    Forum Moderator
    Posted 4 years ago #

    Try replacing:

    query_posts(
    	array (
    		'cat' => 1,
    		//'posts_per_page' => 3,
    		)
    	);

    with:

    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $args= array(
    	'cat' => 1,
    	'paged' => $paged
    );
    query_posts($args);
  3. iheartlolcats
    Member
    Posted 4 years ago #

    Thanks, that along with the wp-pagenavi worked great!

  4. uogecko
    Member
    Posted 4 years ago #

    This helped me too - thanks esmi!

Topic Closed

This topic has been closed to new replies.

About this Topic