Page 2 of posts resulting in the same posts
-
Hi
I have created a page template for my news page which will show posts from the ‘news’ category. After that I assigned the template to the news page from the ‘edit page’ menu.The problem is that on clicking previous posts, the posts stay there.
<?php /* Template Name: News */ ?> <?php get_header(); ?> <div style="margin-top:20px;"></div> <?php $style_classes = array('news1','news2','news3','news4','news5','news6','news7','news8','news9','news10'); $styles_count = count($style_classes); $style_index = 0; ?> <?php query_posts("cat=17&showposts=10"); ?> <?php if (have_posts()) : ?> <div class="alignleft"><?php next_posts_link('« Older Entries') ?></div> <div class="alignright"><?php previous_posts_link('Newer Entries »') ?></div> <br style="clear: both;" /> <br style="clear: both;" /> <?php while (have_posts()) : the_post(); ?> <div class="news_post <?php $k = $style_index % $styles_count; echo "$style_classes[$k]"; ?>" style="background-color:#0F9;"> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"> <img src="<?php echo get_post_meta($post->ID, "news", true);?>" alt="Permanent Link to <?php the_title_attribute(); ?>" /> </a> <div class="news_date"><?php the_time('d M'); ?></div> <div class="news_heading <?php $k = $style_index % $styles_count; echo "heading-$style_classes[$k]"; $style_index++; ?>"> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a> </div> </div> <?php endwhile; ?> <br style="clear: both;" /> <div class="alignleft"><?php next_posts_link('« Older Entries') ?></div> <div class="alignright"><?php previous_posts_link('Newer Entries »') ?></div> <br style="clear: both;" /> <?php else : ?> <h2>Not Found</h2> <p>Sorry, but you are looking for something that isn't here.</p> <?php get_search_form(); ?> <?php endif; ?> <?php get_footer(); ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Page 2 of posts resulting in the same posts’ is closed to new replies.