Title: Problem with next previous buttons
Last modified: August 21, 2016

---

# Problem with next previous buttons

 *  Resolved [mrspabs](https://wordpress.org/support/users/mrspabs/)
 * (@mrspabs)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/problem-with-next-previous-buttons/)
 * This is the code from index.php. It works great except on the front page. As 
   you can see in the first line, i have specified that category 250 should not 
   display on the front page. The query works, but the next previous buttons don’t
   work. When i click, is shows the same 10 posts over and over again.
 *     ```
       <?php if (is_front_page()) {	  query_posts('cat=-250');  } ?>
       <?php while ( have_posts() ) : the_post(); ?>
       <article class="entry home">
       <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
       <div class="fixedheightentry"><?php excerpt('50'); ?></div>
       <span class="post-date"> Posted by <?php the_author_link(); ?> on <?php the_time('F jS, Y') ?></span>
       </div>
       <span class="meta">
       <a class="read-more-s" href="<?php the_permalink()?>" title="Permanent Link to <?php the_title_attribute(); ?>">Read More</a>
       </span>
       </article>
       <?php endwhile; ?>
   
       <span class="new_posts"><?php previous_posts_link('Newer',''); ?></span>
       <span class="old_posts"><?php next_posts_link('Older',''); ?> </span>
       ```
   

Viewing 1 replies (of 1 total)

 *  Thread Starter [mrspabs](https://wordpress.org/support/users/mrspabs/)
 * (@mrspabs)
 * [12 years, 10 months ago](https://wordpress.org/support/topic/problem-with-next-previous-buttons/#post-4141212)
 * I resolved this
 * replace
    `<?php if (is_front_page()) { query_posts('cat=-250'); } ?>` with
 *     ```
       <?php
       if (is_home()) {
       $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
       query_posts("cat=-250&paged=$paged");
       }
       ?>
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘Problem with next previous buttons’ is closed to new replies.

 * 1 reply
 * 1 participant
 * Last reply from: [mrspabs](https://wordpress.org/support/users/mrspabs/)
 * Last activity: [12 years, 10 months ago](https://wordpress.org/support/topic/problem-with-next-previous-buttons/#post-4141212)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
