WP-PageNavi Issues, Url changes but the posts remain the same?

The issue I am having is I have created a new blog page on its own page template page being called blog.php, I have pulled 5 posts into each page and the first page work great and link to the single posts that they are attached too.

When I try to add wp-pagenavi into my nav-below I run into an issue. What happens is I will click to go the next page and it changes the url, but the posts remain the same as before, when it should be switching them to the next set.

I don't know if you can use wp-pagenavi outside of index.php, but if anyone can let me know what I am doing wrong here and why I continue to get the same posts that would be awesome and greatly appreciated. I have one of my blogs on blog.php and that is the file I am trying to get to work. I have posted the code for it below.

<?php
/**
 * Template Name: Blog Page  <?php query_posts("posts_per_page=8"); ?>
 */
 get_header(); ?>

    <div id="content">
    <?php query_posts( array( 'post_type' => 'post', 'posts_per_page=5' ) ); ?>
    <?php 
    //THE LOOP.
    if( have_posts() ): 
        while( have_posts() ):
        the_post(); ?>

        <article id="post-1" <?php post_class( 'clearfix' ); ?>>
            <h2 class="entry-title"> <a href="<?php the_permalink(); ?>"> 
                <?php the_title(); ?> 
            </a></h2>
            <div class="postmeta"> 
                <span class="author"> Posted by: <?php the_author(); ?> </span> 
                <span class="date"> <?php the_date(); ?> </span> 
                <span class="num-comments"> 
            <?php comments_number('No comments yet', 'One comment', '% comments'); ?></span> 
                <span class="categories"> 
                    <?php the_category(); ?>                
                </span> 
                <span class="tags">
                    <?php the_tags(); ?>
                </span> 
            </div><!-- end postmeta --> 

            <?php if( has_post_thumbnail() ): ?>
            <div class="thumb">
                <?php the_post_thumbnail( 'thumbnail' ); ?>
            </div>
            <?php endif; ?>           

            <div class="entry-content">
                <?php 
            if( is_single()  OR is_page() ):

                    the_content();

                else:

                    the_excerpt();

                endif;

                ?>
            </div>


        <?php comments_template(); ?>
         </article><!-- end post -->
      <?php 
      endwhile;
      else: ?>
      <h2>Sorry, no posts found</h2>
      <?php endif; //END OF LOOP. ?>


        <div id="nav-below" class="pagination"> 
         <?php if( function_exists('wp_pagenavi') ): 
                 wp_pagenavi();
             else:
           ?>

            <?php next_posts_link( '&larr; Older Posts' ); ?>
            <?php previous_posts_link( 'Newer Posts &rarr;' ); ?>

            <?php endif; ?>
        </div><!-- end #nav-below --> 
    </div><!-- end content -->

<?php get_footer(); ?>  

Answers


After <div id="content"> have this code:

<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; ?>
<?php query_posts( array( 'post_type' => 'post', 'posts_per_page=5', 'paged' => $paged ) ); ?>

Need Your Help

Is there any possible way to fix the url that Kaminari pagination generates?

ruby-on-rails ruby-on-rails-3 kaminari

I was implementing a chat system to my app, in which only the list of comments will be reloaded with ajax submit.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.