Most WordPress themes, by default, come with Recent Posts displayed automatically. Depending on the type of blog you run, it is possible that you would prefer to display Recent Posts per category. If this is the case, here is what you need to do to only display recent posts for specific categories.
First, you’ll want to find your Recent Posts code, which is usually found in the sidebar. It will look something like this:
<?php get_archives('postbypost', 10); ?>
As always, make sure you have a backup of the file in question before making any changes. You’ll then want to replace the above code with the following code:
<?php $recent = new WP_Query("cat=1&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=1, you’ll want 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.