Why don’t you use WP_Query
. You can pass array as parameter. The array can contain category, number of posts, order etc. Then you can use the while loop to display posts and wrap them in html.
Please go to http://wordpress.org and look for WP_Query
for further details.