wordpress - WP-PageNavi Issues, Url changes but the posts remain the same? -
the issue having have created new blog page on own page template page being called blog.php, have pulled 5 posts each page , first page work great , link single posts attached too.
when try add wp-pagenavi nav-below run issue. happens click go next page , changes url, posts remain same before, when should switching them next set.
i don't know if can use wp-pagenavi outside of index.php, if can let me know doing wrong here , why continue same posts awesome , appreciated. have 1 of blogs on blog.php , file trying work. have posted code 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( '← older posts' ); ?> <?php previous_posts_link( 'newer posts →' ); ?> <?php endif; ?> </div><!-- end #nav-below --> </div><!-- end content --> <?php get_footer(); ?>
after <div id="content">
have 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 ) ); ?>
Comments
Post a Comment