Pagination Issues with Category Posts on Page
-
I am using the following code to to display my category posts for a particular category on a page however none of my pagination works and I am left with only a single page of posts and no options to go to older posts.
<?php /** * Template Name: Insights * * Selectable from a dropdown menu on the edit page screen. */ ?> <?php get_header(); rewind_posts(); ?> <div class="archive"> <?php query_posts('cat=9&posts_per_page=6'); if (have_posts()) :?> <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?> <?php /* If this is a category archive */ if (is_category()) { ?> <h6></h6> <?php /* If this is a tag archive */ } elseif( is_tag() ) { ?> <h6>Posts Tagged ‘<?php single_tag_title(); ?>’</h6> <?php /* If this is a daily archive */ } elseif (is_day()) { ?> <h6>Archive for <?php the_time('F jS, Y'); ?></h6> <?php /* If this is a monthly archive */ } elseif (is_month()) { ?> <h6>Archive for <?php the_time('F, Y'); ?></h6> <?php /* If this is a yearly archive */ } elseif (is_year()) { ?> <h6>Archive for <?php the_time('Y'); ?></h6> <?php /* If this is an author archive */ } elseif (is_author()) { ?> <h6>Author Archive</h6> <?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?> <h6>Blog Archives</h6> <?php } ?> <div class="clear"></div> <?php $i = 0; ?> <?php while (have_posts()) : the_post(); $i++; ?> <div class="span-8 post-<?php the_ID(); ?><?php if ($i == 3) { ?> last<?php } ?>"> <h6 class="archive-header"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title() ?></a></h6> <?php the_content(); ?> <p class="postmetadata"><?php the_time( get_option( 'date_format' ) ); ?> | <?php comments_popup_link('Comments »', '1 Comment »', '% Comments »'); ?></p> </div> <?php if ($i == 3) { ?><div class="archive-stack clear"></div><?php $i = 0; } ?> <?php endwhile; ?> <? wp_reset_query(); ?> <div class="clear"></div> <div class="nav-interior"> <div class="prev"><?php next_posts_link('« Older Entries') ?></div> <div class="next"><?php previous_posts_link('Newer Entries »') ?></div> </div> <div class="clear"></div> <?php else : ?> <h2 class="center">Not Found</h2> <?php include (TEMPLATEPATH . '/searchform.php'); ?> <?php endif; ?> </div> <?php get_template_part( 'bottom' ); ?> <?php get_footer(); ?>Any help would be great.
-
You did not specify a blog address or reason for posting when you created this topic.
This support forum is for blogs hosted at WordPress.com. If your question is about a self-hosted WordPress blog then you’ll find help at the WordPress.org forums.
If you don’t understand the difference between WordPress.com and WordPress.org, you may find this information helpful.
If you forgot to include a link to your blog, you can reply and include it below. It’ll help people to answer your question.
This is an automated message.
- The topic ‘Pagination Issues with Category Posts on Page’ is closed to new replies.