in

WordPress: Show latest posts in the sidebar

WP: Show latest posts in the sidebar

Here is simple but useful WordPress code to show latest posts on your sidebar. Code written by catswhocode.com. How to use this code? Just open up the sidebar.php file and insert the following code to display the four latest posts in an unordered list:

<?php query_posts(‘showposts=4’); ?>
<ul>
<?php while (have_posts()) : the_post(); ?>
<li><a href=”<?php the_permalink() ?>”><?php the_title(); ?></a></li>
<?php endwhile; ?>
</ul>

How to show more or less latest posts in sidebar?
<?php query_posts(‘showposts=4‘); ?> where is 4 insert how much posts you want to see in your sidebar.

Source: CatsWhoCode

Written by Henry Has

Easter Freebies

Illustrator freebies: Line Art Background Vector