Previous Post link does not work
-
Hello,
I am having trouble getting my previous post link to work at the bottom of my home page (TruthLighthouse.com). My theme originally did not have a previous post link so I started working on trying to get one. For now, it has a simple link that takes them to the archives but I literally want it to go to the list of the previous posts. I read various topics on the subject and none seemed to work. I tried editing the index.php with the following code –
<?php next_posts_link('Older Entries »', 0); ?><?php previous_posts_link('« Newer Entries', 0) ?>and at first, it seems to be working. It produces a previous post link at the bottom. If I click it, however, it simply reproduces the same page. It does not list the older posts. Below is the code I currently have.<!-- Middle Column --> <div id="midcolumn"> <h2>Recent Posts</h2> <!-- Loop for latest news --> <?php $oddentry = 'class="gray" '; ?> <?php query_posts('cat=13,14,15,16,17,18,19,20,21,29,30,22,23,24,25,28,26,27&orderby=rand&showposts=10'); ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div <?php echo $oddentry; ?>> <div class="midcolumnpost"> <h3><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3> <?php the_excerpt('Read More', '<img><a>', 'content', false, 'More...', true);?> <div class="details"> | <a href="<?php echo get_permalink(); ?>" title="Read More">Read More</a> </div> </div> </div> <?php /* Changes every other post to a different class */ $oddentry = ( empty( $oddentry ) ) ? 'class="gray" ' : ''; ?> <!-- End of Loop for middle column --> <?php endwhile; else : ?> <?php endif; ?> <center><b><u><a href="http://www.truthlighthouse.com/archives/">>>>Older Posts<<<</a></u></b></center> </div> <!-- /Middle Column -->I tried the following code and got the results mentioned above.
<!-- Middle Column --> <div id="midcolumn"> <h2>Recent Posts</h2> <!-- Loop for latest news --> <?php $oddentry = 'class="gray" '; ?> <?php query_posts('cat=13,14,15,16,17,18,19,20,21,29,30,22,23,24,25,28,26,27&orderby=rand&showposts=10'); ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div <?php echo $oddentry; ?>> <div class="midcolumnpost"> <h3><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3> <?php the_excerpt('Read More', '<img><a>', 'content', false, 'More...', true);?> <div class="details"> | <a href="<?php echo get_permalink(); ?>" title="Read More">Read More</a> </div> </div> </div> <?php /* Changes every other post to a different class */ $oddentry = ( empty( $oddentry ) ) ? 'class="gray" ' : ''; ?> <!-- End of Loop for middle column --> <?php endwhile; else : ?> <?php endif; ?> <center><b><u><?php next_posts_link('Older Entries »', 0); ?><?php previous_posts_link('« Newer Entries', 0) ?></u></b></center> </div> <!-- /Middle Column -->Any ideas why this will not show the actual previous posts?
The topic ‘Previous Post link does not work’ is closed to new replies.