Title: Broken Loop
Last modified: August 20, 2016

---

# Broken Loop

 *  Resolved [scheric1](https://wordpress.org/support/users/scheric1/)
 * (@scheric1)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/broken-loop-1/)
 * I have a template that I have created for wordpress. My template has two blog
   rolls (Home page and a second page). What I am trying to accomplish is _only 
   _display posts in “category A” on the second page. All other posts should display
   on the main page.
 * This is currently working but has created a new problem for me. When I try to
   navigate to the “Next page” of the blog list on the Home Page it refreshes with
   the same posts as the first.
 * Basically I have 3 posts per page and the same 3 posts show up no matter how 
   far I backtrack. Here is a copy of my code in my index. I’m sure it’s just something
   minor that needs to be fixed.
 * Index:
 *     ```
       <?php get_header(); ?>
   
          <br clear="all" />
   
           <div class="content">     <?php get_sidebar(); ?><!--page container starts -->
   
           <div class="blogroll">
           <?php
       if (is_home()) {
       query_posts("cat=-113");
       }
       ?>
       <?php if (have_posts()) : ?>
       <?php while (have_posts()) : the_post(); ?>
           <div class="article">
           		<div class="contentTitle">
             			<h1><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
       <?php the_title(); ?></a></h1>
                   </div><!-- EOF contentTitle -->
       		<div class="description">
         				<?php the_content() ?><br />
       <div class="key"><?php the_tags('<strong>Keywords:</strong> ',' • ','<br />'); ?></div>
                         <div class="additional"><span style="font-style:italic">Posted: </span><strong><?php the_time('F jS, Y') ?></strong> | <span style="font-style:italic">Category: </span><strong><?php the_category(' '); ?></strong> | <span style="font-style:italic">Uploaded by:</span>  <strong><?php the_author(); ?> </strong>
   
                  </div><!-- EOF Additional -->
                  <hr />
         		<br />
       	</div><!--EOF Description-->
           </div><!-- EOF Article -->
   
           <br /><!-- EOF Article -->
           <?php endwhile; ?>
           <?php else : ?>
           <div align="center">
             <h2>No Posts to Display...</h2></div><?php endif; ?>
       <div class="navigation">
         <div align="left" style="float:left"><?php previous_posts_link('« Previous Entries') ?></div>
         <div align="right"><?php next_posts_link('Next Entries »') ?></div>
       </div>
       </div>
       <!-- End of blogroll -->
   
          <div class="sidebar2">
       <div class="sidebar2">
       	<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('sidebarwidget2') ) : ?>
           <?php endif; ?>
       </div>
       </div>
       </div>
       <?php get_footer() ?>
       ```
   
 * Functions:
 *     ```
       <?php
   
       if ( function_exists('register_sidebar') ) {
   
          register_sidebar(array(
       	'name' => 'sidebarwidget',
       	'before_widget' => '<div class="sidebar">',
       	'after_widget' => '</div><br clear="all" />',
       	'before_title' => '<div class="title">
       			  <h2>',
       	'after_title' => '</h2></div>',
       	'class' => '.widget',
           ));
   
       	register_sidebar(array(
        'name' => 'sidebarwidget2',
         'before_widget' => '<div class="sidebar2">',
         'after_widget' => '</div><br clear="all" />',
         'before_title' => '<div class="title">
       			<h2>',
         'after_title' => '</h2></div>',
         'class' => '.widget',
        ));
   
          register_sidebar(array(
          'name' => 'linker',
       	'before_widget' => '<div class="sidebarIn">',
       	'after_widget' => '</div><br clear="all" />',
       	'before_title' => '<div class="title">
       			  <h2>',
       	'after_title' => '</h2></div>',
       	'class' => '.widget',
          ));
   
       }
   
       function register_my_menus() {
         register_nav_menus(
           array( 'header-menu' => __( 'Header Menu' ) )
         );
       }
       add_action( 'init', 'register_my_menus' );
   
       function home_page_menu_args( $args ) {
       $args['show_home'] = true;
       return $args;
       }
       add_filter( 'wp_page_menu_args', 'home_page_menu_args' );
   
       function custom_tag_cloud_widget($args) {
       	$args['number'] = 0; //adding a 0 will display all tags
       	$args['largest'] = 16; //largest tag
       	$args['smallest'] = 16; //smallest tag
       	$args['unit'] = 'px'; //tag font unit
       	$args['format'] = 'list'; //ul with a class of wp-tag-cloud
       	$args['orderby'] = 'count'; //change list order by popularity
       	return $args;
       }
       add_filter( 'widget_tag_cloud_args', 'custom_tag_cloud_widget' );
       //Navigation
       add_action('init','register_custom_menu');
       function register_custom_menu(){
       register_nav_menu('custom_menu',__('Custom Menu'));
       }
       ?>
       ```
   

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

 *  [vtxyzzy](https://wordpress.org/support/users/vtxyzzy/)
 * (@vtxyzzy)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/broken-loop-1/#post-3024889)
 * In order for query_posts to paginate, you must include the ‘paged’ argument. 
   Try changing this:
 *     ```
       query_posts("cat=-113");
       ```
   
 * to this:
 *     ```
       $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
       query_posts("cat=-113&paged=$paged");
       ```
   
 *  Thread Starter [scheric1](https://wordpress.org/support/users/scheric1/)
 * (@scheric1)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/broken-loop-1/#post-3024894)
 * Thank you!

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

The topic ‘Broken Loop’ is closed to new replies.

## Tags

 * [exclude categories](https://wordpress.org/support/topic-tag/exclude-categories/)
 * [homepage](https://wordpress.org/support/topic-tag/homepage/)
 * [loop](https://wordpress.org/support/topic-tag/loop/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [scheric1](https://wordpress.org/support/users/scheric1/)
 * Last activity: [13 years, 8 months ago](https://wordpress.org/support/topic/broken-loop-1/#post-3024894)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
