22
Dec
2009

Display Recent Posts below every post

Posted in: WordPress Tips and Tricks No Comments

You may have seen on many WordPress blog list of “Recent post” and “Related posts” at bottom of every post. I don’t know if there is any such plugin for this.

To add 5 latests post at bottom of every post , open single.php from the theme folder. Find following codes:

<?php comments_template(); ?>
<?php endwhile; else: ?>
<p>Sorry, no posts matched your criteria.</p>
<?php endif; ?>

<?php comments_template(); ?>
<?php endwhile; else: ?>
<p>Sorry, no posts matched your criteria.</p>
<?php endif; ?>

After this add following codes:

<h2>Recent Posts</h2>
<?php query_posts(‘showposts=5′); ?>
<ul>
<?php while (have_posts()) : the_post(); ?>
<li><a href=”<?php the_permalink() ?>”><?php the_title(); ?></a></li>
<?php endwhile;?>
</ul>

browse premium wordpress themes

About the Author

Name: Ravi Shekhar
I love blogging and designing WordPress and Drupal themes.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>