Support » Fixing WordPress » No links to next and previous?

  • Resolved WordyPresser

    (@jeremyduffy)


    I have my page set up with a static page for the home page and I have to set one for posts to when I do that. To make my blog posts look normal, I created a page called “blog” that uses the default template that looks like this:

    <?php get_header(); ?>
    
      <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    	<div class="navigation">
    		<div class="alignleft"><?php previous_post_link('&laquo; %link') ?></div>
    		<div class="alignright"><?php next_post_link('%link &raquo;') ?></div>
    	</div>
    
    	<div class="post" id="post-<?php the_ID(); ?>">
    		<?php include "title.php"; ?>
    
    		<div class="entry">
    			<?php the_content('<p class="serif">Read the rest of this entry &raquo;</p>'); ?>
    
    			<?php link_pages('<p><strong>Pages:</strong> ', '</p>', 'number'); ?>
    			<?php the_tags(); ?>
    		</div>
    		<?php comments_template(); ?>
    	</div>
    
    	<?php endwhile; else: ?>
    
    		<p>Sorry, no posts matched your criteria.</p>
    
    <?php endif; ?>
    
    <?php get_footer(); ?>

    For some reason, there are no “next” or “previous” links. I don’t know what’s going on 🙁

Viewing 3 replies - 1 through 3 (of 3 total)
  • According to Administration > Settings > Reading

    Also, any Template assigned the Page will be ignored and the theme’s index.php (or home.php if it exists) will control the display of the posts.

    do you mean:
    http://codex.wordpress.org/Template_Tags/next_posts_link

    as in the example from the default theme:

    <?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 : ?>

    (put in between ‘endwhile’ and ‘else’)

    Thread Starter WordyPresser

    (@jeremyduffy)

    Michael, I did not know that, thank you. I’m modifying the index page now and it’s working

    Alchymyth, that’s exactly what I needed. I can see that next_post_link is for single-view post pages while next_posts_link (with the s) is for navigation of blog results. That’s what I was missing!

    Thanks both!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘No links to next and previous?’ is closed to new replies.