I use the Category Posts widget on a lot of sites to show a list of post titles beneath a category name in the sidebar. It automatically displays posts in descending order from the most recent post to the oldest posts. To change this order, you need to edit the cat-posts.php file in the category-posts plugin directory in the plugins directory.
Here’s the line of code to change:
The Category Posts Widget is very good for showing a certain # of posts in a particular category using a widget that displays on every page. However, if you only want to show the posts for the current category in the sidebar, then add this code to your sidebar.php file:
<?php $sidebar_related_query = new WP_Query('cat=' . $sidebar_cat_id . '&showposts=5&offset=0&orderby=post_date&order=desc'); while ($sidebar_related_query->have_posts()) : $sidebar_related_query->the_post(); $do_not_duplicate = $post->ID; ?> <div id=”post-<?php the_ID(); ?>"> <a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a> </div> <?php endwhile; ?>