Support » Fixing WordPress » No links to next and previous?
No links to next and previous?
-
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('« %link') ?></div> <div class="alignright"><?php next_post_link('%link »') ?></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 »</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 🙁
-
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_linkas in the example from the default theme:
<?php endwhile; ?> <div class="navigation"> <div class="alignleft"><?php next_posts_link('« Older Entries') ?></div> <div class="alignright"><?php previous_posts_link('Newer Entries »') ?></div> </div> <?php else : ?>
(put in between ‘endwhile’ and ‘else’)
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!
- The topic ‘No links to next and previous?’ is closed to new replies.