Title: Previous posts link
Last modified: August 19, 2016

---

# Previous posts link

 *  Resolved [Nydia](https://wordpress.org/support/users/nydia/)
 * (@nydia)
 * [16 years, 2 months ago](https://wordpress.org/support/topic/previous-posts-link/)
 * Hi. This has already been discussed [here](http://wordpress.org/support/topic/369386?replies=10).
   I’m using [this](http://www.smashingmagazine.com/2010/02/20/free-dark-and-clean-wordpress-theme-designpile/)
   theme layout, and when I try to display the “Next and Previous posts link”, it
   just doesn’t show. I’m sure I followed everything said in that post, but I don’t
   understand PHP, so I don’t know how to solve it.
 * Here is the code for the index.php and the home.php files:
 * **index.php**:
 *     ```
       <?php get_header(); ?>
   
       		<!-- begin colLeft -->
       		<div id="colLeft">
               <!-- begin colLeftInner -->
               <div id="colLeftInner" class="clearfix">
       		<!-- archive-title -->
       						<?php if(is_month()) { ?>
       						<div id="archive-title">
       						Browsing articles from "<strong><?php the_time('F, Y') ?></strong>"
       						</div>
       						<?php } ?>
       						<?php if(is_category()) { ?>
       						<div id="archive-title">
       						Browsing articles in "<strong><?php $current_category = single_cat_title("", true); ?></strong>"
       						</div>
       						<?php } ?>
       						<?php if(is_tag()) { ?>
       						<div id="archive-title">
       						Browsing articles tagged with "<strong><?php wp_title('',true,''); ?></strong>"
       						</div>
       						<?php } ?>
       						<?php if(is_author()) { ?>
       						<div id="archive-title">
       						Browsing articles by "<strong><?php wp_title('',true,''); ?></strong>"
       						</div>
       						<?php } ?>
       					<!-- /archive-title -->
       		<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
   
               <!-- begin post -->
               <div class="blogPost">
               				<div class="date"><?php the_time('M') ?><br /><span><?php the_time('j') ?></span></div>
       						<h1><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h1>
       						<div class="meta">
       							By <span class="author"><?php the_author_link(); ?></span> &nbsp;//&nbsp;  <?php the_category(', ') ?>  &nbsp;//&nbsp;  <?php comments_popup_link('No Comments', '1 Comment ', '% Comments'); ?>
       						</div>
       						<?php the_content(__('read more')); ?> 
   
       		</div>
       		<!-- end post -->
       		<?php endwhile; ?>
   
       	<?php else : ?>
   
       		<p>Sorry, but you are looking for something that isn't here.</p>
   
       	<?php endif; ?>
           		</div>
                   <!-- end colLeftInner -->
                   <div class="navigation">
       						<div class="alignleft"><?php next_posts_link() ?></div>
       						<div class="alignright"><?php previous_posts_link() ?></div>
       			</div>
       		</div>
       		<!-- end colLeft -->
   
       <?php get_sidebar(); ?>	
   
       <?php get_footer(); ?>
       ```
   
 * and **home.php**:
 *     ```
       <?php get_header(); ?>
   
       <!-- begin colleft -->
       				<div id="colLeft">
       				<div id="colLeftInner" class="clearfix">
       					<!-- begin fetured post -->
       				 <?php query_posts('tag=featured');?>
                            <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
       					<div id="featuredPost">
       						<span class="label">FEATURED POST</span>
       						<h1><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h1>
       						<div class="meta">
       							By <span class="author"><?php the_author_link(); ?></span> &nbsp;//&nbsp;  <?php the_category(', ') ?>  &nbsp;//&nbsp;  <?php comments_popup_link('No Comments', '1 Comment ', '% Comments'); ?>
       						</div>
       						<div class="featuredDetails"><?php the_excerpt()?>
                               <?php $featured_img = get_post_meta($post->ID, 'featured_img', $single = true); ?>
       						<a href="<?php the_permalink(); ?>"><img src="<?php echo $featured_img ?>" border="0" alt="<?php the_title(); ?>" /></a>
       						</div>
       					</div>
       					<!-- end featured post -->
                          <?php endwhile; ?>
                               <?php else : ?>
                           <?php endif; ?>
   
       					<?php wp_reset_query(); // for pagination ?>
   
       <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; // for pagination ?>				
   
       					<?php $posts_query = new WP_Query($query_string.'&tag=homepost&posts_per_page=-1&paged='.$paged);
       						  if(!$posts_query -> have_posts()){
       							  $latestposts_no = get_option('designpile_latest_posts');
       							  if($latestposts_no != null){
       								 $posts_query = new WP_Query($query_string.'&posts_per_page='.$latestposts_no.'&paged='.$paged);
       							  }else{
       								 $posts_query = new WP_Query($query_string.'&posts_per_page=6&paged='.$paged);
       							  }
       						  }
       						  $odd_or_even = 'odd'; ?>
                               <?php if ($posts_query -> have_posts()) : while ($posts_query -> have_posts()) : $posts_query -> the_post();  ?>
                               <div class="homePost <?php echo $odd_or_even; ?>">
                                   <div class="date"><?php the_time('M') ?><br /><span><?php the_time('j') ?></span></div>
                                    <div class="meta">
                                       By <span class="author"><?php the_author_link(); ?></span> &nbsp;//&nbsp;  <?php comments_popup_link('No Comments', '1 Comment ', '% Comments'); ?>
                                   </div>
                                   <h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
   
                                   <div><a href="#"><img src="<?php if ( function_exists('p75GetThumbnail') )echo p75GetThumbnail($post->ID); ?>" alt="" /></a><?php the_excerpt(); ?> </div>
                               </div>
                               <?php $odd_or_even = ('odd'==$odd_or_even) ? 'even' : 'odd'; ?>
                               <?php endwhile; ?>
   
                               <?php else : ?>
   
                                   <p>Sorry, but you are looking for something that isn't here.</p>
   
                               <?php endif; ?>
   
       					 </div>
       					<!-- end colleftInner -->
       	<div class="navigation">
       		<div class="alignleft"><?php next_posts_link('&laquo; Older Entries'); // pagination ?></div>
       		<div class="alignright"><?php previous_posts_link('Newer Entries &raquo;'); // pagination ?></div>
       	</div>
       				</div>
       			<!-- end colleft -->
       			<?php get_sidebar(); ?>	
   
       <?php get_footer(); ?>
       ```
   
 * I’ll post it on pastebin if necessary, just tell me.
    Thank you.

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

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [16 years, 2 months ago](https://wordpress.org/support/topic/previous-posts-link/#post-1443657)
 * a link to see the site would help.
 * as the suggestion worked in the quoted thread there has to be something different
   in your setup.
 * are you using plugins?
    if so, try deactivating all plugins, and if that solves
   the problem, re-activate the plugins one ofter the other to see which triggers
   the problem.
 * do you have enough post to need pagination?
 *  [Shane G.](https://wordpress.org/support/users/shane-g-1/)
 * (@shane-g-1)
 * [16 years, 2 months ago](https://wordpress.org/support/topic/previous-posts-link/#post-1443658)
 * Hi,
 * Check with this article:
 * [http://codex.wordpress.org/Next_and_Previous_Links](http://codex.wordpress.org/Next_and_Previous_Links)
 * Also refer this plugin:
 * [http://wordpress.org/extend/plugins/wordpress-navigation-list-plugin-navt/](http://wordpress.org/extend/plugins/wordpress-navigation-list-plugin-navt/)
 * Thanks,
 * Shane G.
 *  Thread Starter [Nydia](https://wordpress.org/support/users/nydia/)
 * (@nydia)
 * [16 years, 2 months ago](https://wordpress.org/support/topic/previous-posts-link/#post-1443676)
 * It’s working now, I needed the plugin.
    Thanks to both! ^^

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

The topic ‘Previous posts link’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 3 participants
 * Last reply from: [Nydia](https://wordpress.org/support/users/nydia/)
 * Last activity: [16 years, 2 months ago](https://wordpress.org/support/topic/previous-posts-link/#post-1443676)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
