I did group my search results by post type, but how can i give each of them its own order?

Here’s one suggested high level approach to get the desired effect.

  • Rather than perform all your operations in one big while loop in your searchresults.php, try:

    1. establishing three arrays corresponding to each type- you can do this in one while loop.
    2. then sort each array as needed (refer to PHP’s Sorting Arrays documentation for the various ways to sort a multidimensional array)
    3. then output the section heading and loop through your teasers of posts for each type.
  • Alternatively, in your group_by_post_type function’s if statement, you can perform steps 1 & 2 above, and then merge the arrays, returning the merged result and keeping your searchresults.php pretty much intact as you’ve posted it.