Next/Previous 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">»</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">«</span> Older posts', 'bbf' )) ?></div> <div class="nav-next"><?php previous_posts_link(__( 'Newer posts <span class="meta-nav">»</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)
Viewing 1 replies (of 1 total)
- The topic ‘Next/Previous Issues’ is closed to new replies.