In many cases we do require to display the recent posts from a specific category… for that we need to modify the sidebar.php file of the current active theme and replace code as this:
<?php get_archives(‘postbypost’, 10); ?>
Replace it with:
<?php $recent = new WP_Query(“cat=4&showposts=10”); while($recent-
>have_posts()) : $recent->the_post();?>
<li><a href=”<?php the_permalink() ?>” rel=”bookmark”>
<?php the_title(); ?>
<?php endwhile; ?>
Where is says cat=4 to insert the number assigned to the category that you want to display the posts from. You can find this from your Manage -> Categories page. You can also adjust the number of posts to be displayed where it says showposts=10.
This could be useful to someone who wants to display the most recent few posts from a few different categories in their sidebar.