Pagination is not working properly because of query_post
-
I am currently using wordpress in creating my websites. And i really find a problem regarding pagination. So basically to be able for you to understand what is really my problem, I will post two codes:
This is the first code:
[ Moderator Note: Please post code or markup snippets between backticks or use the code button. ]
<?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div <?php post_class() ?> id="post-<?php the_ID(); ?>"> <h2><a>"><?php the_title(); ?></a></h2> <?php include (TEMPLATEPATH . '/inc/meta.php' ); ?> <div class="entry"> <?php the_excerpt(); ?> </div> <h3><a>">Read More...</a></h3> </div> <?php endwhile; ?> <?php include (TEMPLATEPATH . '/inc/nav.php' ); ?> <?php else : ?> <h2>Not Found</h2> <?php endif; ?>
In this lines of code, I used the regular loop in querying a post. Actually I did not modify the code. I also installed a plugin WP-PageNavi. There is no problem, pagination is working properly.
But when i put this line of code, about the regular loop. Pagination is not working properly. I put this line of code ”
<?php query_posts('cat=8'); ?>
” because I want only to show post in this said category.2nd code:
<---- Line of code -----> <?php query_posts('cat=8'); ?> <---- end line of code -----> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div <?php post_class() ?> id="post-<?php the_ID(); ?>"> <h2><a>"><?php the_title(); ?></a></h2> <?php include (TEMPLATEPATH . '/inc/meta.php' ); ?> <div class="entry"> <?php the_excerpt(); ?> </div> <h3><a>">Read More...</a></h3> </div> <?php endwhile; ?> <?php include (TEMPLATEPATH . '/inc/nav.php' ); ?> <?php else : ?> <h2>Not Found</h2> <?php endif; ?>
My question is: What should i do in order for the pagination to worked properly? I really need some help with this.
- The topic ‘Pagination is not working properly because of query_post’ is closed to new replies.