sort posts by dates

function to sort posts by dates
awesome