Title: Next/Previous Issues
Last modified: August 21, 2016

---

# Next/Previous Issues

 *  [bswb97](https://wordpress.org/support/users/bswb97/)
 * (@bswb97)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/nextprevious-issues/)
 * I’ve taken over an organization’s WP site and I’m trying to clean up some of 
   their code. However, some of it is structurally unorthodox. One issue I’m having
   is with Next/Previous navigation. It appears within the loop on the main index
   and doesn’t appear on the individual posts.
 * If I move the Next/Previous section after the endwhile, the whole thing breaks.
   However, putting test text after the endwhile gets it where I want it (at the
   end of the multi-post index and below the comments on individual posts).
 * Please note that this site (so far) is NOT using single.php.
 * Here is the code of my index.php file:
 *     ```
       <?php get_header(); ?>
       <div id="body_innergreen_container2" class="full-width">
       	<div id="wrap">
       		<div id="top_menu">
       			<?php wp_nav_menu( array('menu' => 'Restructured Menu' ) );?>
       			<div class="clear"></div>
       		</div>
       </div>
       </div>
   
       		<div id="container">
   
       			<div id="middle_container" style="width:731px; margin-top:-10px;">
       				<?php while ( have_posts() ) : the_post() ?>
   
       					<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
       						<h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( __('Permalink to %s', 'your-theme'), the_title_attribute('echo=0') ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
   
       						<div class="entry-meta">
       							<span class="meta-prep meta-prep-author"><?php _e('By ', 'bbf'); ?></span>
       							<span class="author vcard"><a class="url fn n" href="<?php echo get_author_link( false, $authordata->ID, $authordata->user_nicename ); ?>" title="<?php printf( __( 'View all posts by %s', 'bbf' ), $authordata->display_name ); ?>"><?php the_author(); ?></a></span>
       							<span class="meta-sep"> | </span>
       							<span class="meta-prep meta-prep-entry-date"><?php _e('Published ', 'bbf'); ?></span>
       							<span class="entry-date"><abbr class="published" title="<?php the_time('Y-m-d\TH:i:sO') ?>"><?php the_time( get_option( 'date_format' ) ); ?></abbr></span>
       							<?php edit_post_link( __( 'Edit', 'bbf' ), "<span class=\"meta-sep\">|</span>\n\t\t\t\t\t\t<span class=\"edit-link\">", "</span>\n\t\t\t\t\t" ) ?>
       						</div><!-- .entry-meta -->     
   
       						<div class="entry-content">
       							<a name="content"></a><?php the_content( __( 'Continue reading <span class="meta-nav">&raquo;</span>', 'bbf' )  ); ?>
       							<?php wp_link_pages('before=<div class="page-link">' . __( 'Pages:', 'bbf' ) . '&after=</div>') ?>
       						</div><!-- .entry-content -->
   
       						<div class="entry-utility">
       							<?php the_tags( '<span class="tag-links"><span class="entry-utility-prep entry-utility-prep-tag-links">' . __('Filed under ', 'bbf' ) . '</span>', ", ", "</span>\n\t\t\t\t\t\t\n" ) ?>
       <br><br>
   
       							<span class="comments-link"><?php comments_template(); ?>
       </span>
   
       						</div><!-- #entry-utility -->
   
       <?php global $wp_query; $total_pages = $wp_query->max_num_pages; if ( $total_pages > 1 ) { ?>
       						<div id="nav-below" class="navigation">
       							<div class="nav-previous"><?php next_posts_link(__( '<span class="meta-nav">&laquo;</span> Older posts', 'bbf' )) ?></div>
       							<div class="nav-next"><?php previous_posts_link(__( 'Newer posts <span class="meta-nav">&raquo;</span>', 'bbf' )) ?></div>
       						</div>
       						<!-- #nav-below -->
   
       			<?php } ?>
   
       					</div><!-- #post-<?php the_ID(); ?> -->
       				<?php endwhile; ?>
   
       			</div><!-- #content -->
       <div id="right_container" style="margin-top:-20px; padding-right: 10px; background: url('https://www.hoffmaninstitute.org/wp-content/themes/hoffman/images/body_inner02_bg.gif') repeat-x;">
         <?php echo do_shortcode('[RegularRightSidebar]'); ?>
       </div>
   
       		</div><!-- #container -->
   
       <?php get_footer(); ?>
       ```
   

Viewing 1 replies (of 1 total)

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/nextprevious-issues/#post-5065836)
 * individual posts would use [`next_post_link()`](http://codex.wordpress.org/Function_Reference/next_post_link)
   and [`previous_post_link()`](http://codex.wordpress.org/Function_Reference/previous_post_link)

Viewing 1 replies (of 1 total)

The topic ‘Next/Previous Issues’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [Michael](https://wordpress.org/support/users/alchymyth/)
 * Last activity: [11 years, 11 months ago](https://wordpress.org/support/topic/nextprevious-issues/#post-5065836)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
