Let’s assume you are developing your new WordPress theme and you find the need to have a categorical listing of titles for a particular category. For example, you have a category “Giant Robots” and you would like to show your users the five most recent posts in your sidebar. However, you don’t want the content or excerpt to show. You only want post titles. No sweat.
Before we get to the necessary code you will probably want to install the following plugin if you haven’t already. Somewhere along WordPress felt like we didn’t need to know the ID’s of our categories, but it is crucial for something like this. This plugin remedies the problem by revealing the ID’s to us in the dashboard.
You can really use this method anywhere. Use it in the sidebar, a page of categories, or the footer. I’ve used the methods in my own tutorials section if you need a live version of what we’re talking about.
The first thing we’ll do is give our category listing a title:
<h2><a href="<?php echo get_category_link(2); ?>">Giant Robots <span class="viewAll">(view all&$8230;)</span></a></h2>
Explanation: The first thing to notice is here is the number “2″ within get_category_link();. This represents the category ID. To find this you’ll need to install the plugin mentioned previously and login in to your dashboard. Then click manage->categories and you should see the ID in parentheses next to your desired category.
Next, we’ll create a list that displays the titles of our category:
<ul>
<li>
<a title="Permanent link to <?php the_title(); ?>" rel="bookmark" href="<?php the_permalink() ?>"></a></li>
</ul>
Explanation: We start with an unordered list to house everything in. We define the variable $myposts. Again, we must insert the correct category ID, which in our case is “2.” &numberposts=5 simply means that we are limiting the number of listings to 5. Insert whatever number you like.
Then a simple foreach() loop runs through and lists out all the titles with the appropriate permalinks. Finally, it is up to you to use CSS to style the list however you would like. I’ll leave that goodness up to you.
Hopefully this makes sense and you can make good use of it in your WordPress site. If there are questions, just post them in the comments.

Keep up the good work
I’ll do my best.