Title: Same posts on every page?
Last modified: August 20, 2016

---

# Same posts on every page?

 *  [spackletoe](https://wordpress.org/support/users/spackletoe/)
 * (@spackletoe)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/same-posts-on-every-page/)
 * HI all,
 * The blog I have made isn’t working with pagination. I’m using a custom child 
   theme made from twentyeleven. The same posts show up on every page, so clicking“
   Older Posts” link at the bottom of the page brings you to a new page, but shows
   the same ones (URL changes, content doesn’t).
 * here’s the blog here:
    [http://www.tcurranmusic.com/blog/](http://www.tcurranmusic.com/blog/)
 * And here’s a snippet of my code in the blog template:
 *     ```
       <div id="content" role="main">
   
       			<?php query_posts('cat=-7'); ?>
       			<?php if ( have_posts() ) : ?>
   
       				<?php twentyeleven_content_nav( 'nav-above' ); ?>
   
       				<?php /* Start the Loop */ ?>
       				<?php while ( have_posts() ) : the_post(); ?>
   
       					<?php get_template_part( 'content', get_post_format() ); ?>
   
       				<?php endwhile; ?>
   
       				<?php twentyeleven_content_nav( 'nav-below' ); ?>
   
       			<?php else : ?>
   
       				<article id="post-0" class="post no-results not-found">
       					<header class="entry-header">
       						<h1 class="entry-title"><?php _e( 'Nothing Found', 'twentyeleven' ); ?></h1>
       					</header><!-- .entry-header -->
   
       					<div class="entry-content">
       						<p><?php _e( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'twentyeleven' ); ?></p>
       						<?php get_search_form(); ?>
       					</div><!-- .entry-content -->
       				</article><!-- #post-0 -->
   
       			<?php endif; ?>
   
       			</div><!-- #content -->
       ```
   
 * I’m pretty sure the problem lies with my postquery command, but I’m unsure how
   to fix it.
 * Thanks!

Viewing 10 replies - 1 through 10 (of 10 total)

 *  [Joshua Parker](https://wordpress.org/support/users/parkerj/)
 * (@parkerj)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/same-posts-on-every-page/#post-2875408)
 * Excluding posts from category 7, who many posts do you have?
 *  Thread Starter [spackletoe](https://wordpress.org/support/users/spackletoe/)
 * (@spackletoe)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/same-posts-on-every-page/#post-2875410)
 * 25 total. (actually 34 but I’m subtracting the ones in cat 7)
 *  [Joshua Parker](https://wordpress.org/support/users/parkerj/)
 * (@parkerj)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/same-posts-on-every-page/#post-2875414)
 * Are you trying to exclude category 7 on the homepage or exclude it all together?
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/same-posts-on-every-page/#post-2875416)
 * try to change the query code to:
 *     ```
       <?php global $query_string; query_posts($query_string . '&cat=-7'); ?>
       ```
   
 * [http://codex.wordpress.org/Function_Reference/query_posts#Preserving_Existing_Query_Parameters](http://codex.wordpress.org/Function_Reference/query_posts#Preserving_Existing_Query_Parameters)
 *  Thread Starter [spackletoe](https://wordpress.org/support/users/spackletoe/)
 * (@spackletoe)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/same-posts-on-every-page/#post-2875473)
 * Hmmm that didn’t seem to do the trick, alchymyth.
 * As you can see here: [http://www.tcurranmusic.com/blog/page/2/](http://www.tcurranmusic.com/blog/page/2/)
   
   the posts on the 2nd page are the same as the first. What is odd is that the 
   site seems to know that there are only two pages worth of posts to show, as page
   2 doesn’t have a “older posts” link on the bottom.
 * Here’s an odd thing: I removed the query_posts line all together and it’s STILL
   having this problem. And category 7 is still not showing up. Could there be another
   place affecting this setting?
 * [@joshua](https://wordpress.org/support/users/joshua/) – The blog isn’t on the
   home page of the site, but yes, I am needing to eliminate cat 7 from any listing
   within the blog area.
 *  [Joshua Parker](https://wordpress.org/support/users/parkerj/)
 * (@parkerj)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/same-posts-on-every-page/#post-2875474)
 * Try changing it to:
    `query_posts( $query_string . '&posts_per_page=5' . '&cat
   =-7' );`
 * If that doesn’t work, then keep what is posted above and then add this after 
   endwhile;
 * `wp_reset_query();`
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/same-posts-on-every-page/#post-2875477)
 * check your syntax – particluar make sure to have the `&` before the `cat=-7`
 *     ```
       <?php global $query_string; query_posts($query_string . '&cat=-7'); ?>
       ```
   
 * the suggested code works in a child theme of Twenty Eleven in my local test setup.
 *  Thread Starter [spackletoe](https://wordpress.org/support/users/spackletoe/)
 * (@spackletoe)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/same-posts-on-every-page/#post-2875479)
 * There must be something else afoot here. I’ve tried both suggestions and neither
   work. 🙁
 *  [Joshua Parker](https://wordpress.org/support/users/parkerj/)
 * (@parkerj)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/same-posts-on-every-page/#post-2875482)
 * Yeah, the code for twentyeleven is the same and the only difference we can see
   is query_posts(‘cat=-7’);, but we already established that isn’t the issue. Off
   hand, I can’t see where the issue lies unless you are using some type of category
   or post plugin that is conflicted with what you are trying to do.
 *  Thread Starter [spackletoe](https://wordpress.org/support/users/spackletoe/)
 * (@spackletoe)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/same-posts-on-every-page/#post-2875485)
 * Thanks for your continued help guys… I don’t think I have any plugin conflicts.
   I did find another weird thing. In my Settings > Reading I have the “Blog pages
   show at most” set at 10. With the code above that instructs to limit it to 5,
   it doesn’t change. It stays at 10. If I change that 10 to a 5 THEN it limits 
   the page, but the hardcoded line above doesn’t seem to influence things at all.

Viewing 10 replies - 1 through 10 (of 10 total)

The topic ‘Same posts on every page?’ is closed to new replies.

## Tags

 * [pagination](https://wordpress.org/support/topic-tag/pagination/)

 * 10 replies
 * 3 participants
 * Last reply from: [spackletoe](https://wordpress.org/support/users/spackletoe/)
 * Last activity: [13 years, 10 months ago](https://wordpress.org/support/topic/same-posts-on-every-page/#post-2875485)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
