Title: Next Post/Previous Post Problem
Last modified: August 19, 2016

---

# Next Post/Previous Post Problem

 *  Resolved [thsoto](https://wordpress.org/support/users/thsoto/)
 * (@thsoto)
 * [16 years, 4 months ago](https://wordpress.org/support/topic/next-postprevious-post-problem/)
 * I have the following code on my home page.
 * >  <?php if (have_posts()) : ?>
   >  <?php while (have_posts()) : the_post(); ?>
   >  <div <?php post_class() ?> id=”post-<?php the_ID(); ?>”>
   > </span>
   >  <span class=”date”><?php the_time(‘F jS, Y’) ?></span> <div class=”
   > entry”> <?php the_content(‘Read the rest of this entry »’); ?> </div> </div
   > >
   >  <?php endwhile; ?>
   >  <div class=”navigation”> <div class=”alignleft”><?php 
   > next_posts(‘« Older Articles’) ?></div> <div class=”alignright”><?php previous_posts(‘
   > Newer Articles »’) ?></div> </div> <?php else : ?> <h2 class=”center”>Not Found
   > </h2> <p class=”center”>Sorry, but you are looking for something that isn’t
   > here.</p> <?php get_search_form(); ?>
   >  <?php endif; ?>
 * It is not showing the links for Next and Previous Articles. All it shows is my
   web address.
 * Can someone tell me what I have done wrong?
 * Thanks

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [kz](https://wordpress.org/support/users/kz/)
 * (@kz)
 * [16 years, 4 months ago](https://wordpress.org/support/topic/next-postprevious-post-problem/#post-1364671)
 * next_posts_link and previous_posts_link will work fine with label.
 *     ```
       <div class="alignleft"><?php next_posts_link('« Older Articles') ?></div>
       <div class="alignright"><?php previous_posts_link('Newer Articles »') ?></div>
       ```
   
 *  Thread Starter [thsoto](https://wordpress.org/support/users/thsoto/)
 * (@thsoto)
 * [16 years, 4 months ago](https://wordpress.org/support/topic/next-postprevious-post-problem/#post-1364698)
 * Thanks! I originally had that and it was showing up. Just tried it again and 
   it works. The only thing I changed was in the Settings > Reading section I changed
   the Blog posts to 1 instead of the default of 10. Apparently, that’s why it wasn’t
   showing up.
 *  Thread Starter [thsoto](https://wordpress.org/support/users/thsoto/)
 * (@thsoto)
 * [16 years, 4 months ago](https://wordpress.org/support/topic/next-postprevious-post-problem/#post-1364708)
 * Having the same problem on my single.php page.
 *     ```
       <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
       		<div id="textwrap"><h1><?php the_title(); ?></h1>
       			<div id="textarea">
       				<span class="date"><?php the_time('F jS, Y') ?></span><br />
   
       				<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
   
       					<div class="entry">
       						<?php the_content('<p class="serif">Read the rest of this entry &raquo;</p>'); ?>
       						<?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
       						<?php the_tags( '<p>Tags: ', ', ', '</p>'); ?>
       					</div>
       				</div>
       		<?php //comments_template(); ?>
       		<?php endwhile; ?>
       				<div class="navigation">
       					<div class="alignleft"><?php next_posts_link('&laquo; Older Articles') ?></div>
       					<div class="alignright"><?php previous_posts_link('Newer Articles &raquo;') ?></div>
       				</div>
       		<?php else: ?>
       			<p>Sorry, no posts matched your criteria.</p>
   
       	<?php endif; ?>
       ```
   
 * Why won’t it display on these?
 * Thanks!
 *  [kz](https://wordpress.org/support/users/kz/)
 * (@kz)
 * [16 years, 4 months ago](https://wordpress.org/support/topic/next-postprevious-post-problem/#post-1364715)
 * In single.php use next_post_link and previous_post_link
 * > next_post_link(‘%link’, ‘« Older Articles’)
   >  previous_post_link(‘%link’, ‘Newer
   > Articles »’)
 *  Thread Starter [thsoto](https://wordpress.org/support/users/thsoto/)
 * (@thsoto)
 * [16 years, 4 months ago](https://wordpress.org/support/topic/next-postprevious-post-problem/#post-1364881)
 * Thanks! That worked!

Viewing 5 replies - 1 through 5 (of 5 total)

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

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 5 replies
 * 2 participants
 * Last reply from: [thsoto](https://wordpress.org/support/users/thsoto/)
 * Last activity: [16 years, 4 months ago](https://wordpress.org/support/topic/next-postprevious-post-problem/#post-1364881)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
