WordPress.org

Ready to get started?Download WordPress

Forums

WP-PageNavi
Navigation links show same posts no matter which page (2 posts)

  1. McMorrisDesigns
    Member
    Posted 6 months ago #

    I have just installed pagenavi to handle the pagination for my blog posts. The issue here is that there are 2 seprate "blog" pages so instead of using the default index template i am using a custom page template for each of the 2 pages which will contain posts.

    The way I have it set up is that I have 2 categories, which category the posts are assigned to determines which page to display the post on.

    I added the pagenavi code below my loop and the links display properly, but when I click "previous posts" it takes me to /page/2 but it shows the same posts that were on the first page instead of showing older posts.

    Also, this is my first attempt at coding a WordPress theme from scratch so if you have any other pointers for my loop, it would be greatly appreciated! Thanks in advance!

    <?php query_posts('category_name='.get_the_title().'&post_status=publish,future');?>
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    	<div class="row moduleRow">
    		<a>" title="<?php the_title(); ?>">
    		    <div class="five left">
    		        <div class="module yellowModule whiteBorder">
    				<?php if ( has_post_thumbnail() ) { the_post_thumbnail(); } ?>
    		        </div>
    		    </div>
            </a>
    		    <div class="seven left">
    		        <div class="module modulePadding yellowModule whiteBorder">
    		            <a>" title="<?php the_title(); ?>">
                            <h3><?php the_title(); ?></h3>
                            <h4><?php the_time('F j, Y') ?></h4>
                        </a>
    		            <span style="color:#696158;"><?php echo content(125); ?></span>
    		        </div>
    		    </div><!--end seven-->
    	</div>
        	<?php echo dividerRow(); ?>
    		<?php endwhile; else: endif; ?>
            <div class="pagenav">
    			<?php wp_pagenavi(); ?>
    		</div>

    http://wordpress.org/plugins/wp-pagenavi/

  2. psperkins
    Member
    Posted 6 months ago #

    Try adding the "paged" parameter to your initial query like so:

    <?php query_posts('category_name='.get_the_title().'&post_status=publish,future&paged='.get_query_var('paged'));?>

Reply

You must log in to post.

About this Plugin

About this Topic