• I have all of my posts in all categories just list out on my main blog page. (index.php)

    At the bottom, outside of The Loop there are next and previous links that take me back and forth through pages of all my posts.

    I want to put prev/next links on each post individually so people can go to the previous post in that category without first having to go to that post’s single page. But no matter what I do, the prev/next links will not show up. I know they have to be inside The Loop. I’ve done that. I’ve tried putting them along side different elements that do show up so I know it’s not a weird formatting bug. I’ve also tried putting the most basic link to make sure it’s not balking at some random little thing.

    Here’s the code I’m using. It’s pretty basic.

    <?php if (have_posts()) : ?>
    
      <?php while (have_posts()) : the_post(); ?>
    
        <div class="post" id="post-<?php the_ID(); ?>">
    	<div class="entry">
    
    		<span class="post-views"><?php if(function_exists('the_views')) { the_views(); } ?></span>
    		<span class="post-time"><?php the_time('F jS, Y') ?> </span>
    		<span class="post-cat"><?php previous_post_link(); ?><?php the_category(', ') ?></span></br> //I added one here near where the category displays.
    
    		<div id="bg">
    			<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a> <?php edit_post_link('e','',''); ?></h2>
    		</div>
    
    		<div class="post-content">
    			<?php the_content('Read More  &raquo;'); ?>
    
                            //I added these in the post content section itself.
    			<?php previous_post_link('&laquo; %link', 'Previous post in category: %title', TRUE); ?>
    			<?php next_post_link('%link &raquo;', 'Next post in category: %title', TRUE); ?>
    
    			<div class="postmetadata">
    				<span class="post-author"> by <?php the_author() ?></span>
    				<span class="post-comments"><?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></span>
    			</div>
    		</div>
    	</div>
         </div>
      <hr>
      <?php endwhile; ?>
    
    	<div class="navigation">
    		<div class="alignleft"><?php next_posts_link('&laquo; Older Entries') ?></div>
    		<div class="alignright"><?php previous_posts_link('Newer Entries &raquo;') ?></div>
    	</div>
    
    <?php else : ?>

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘No prev or next links on main page’ is closed to new replies.