title: wordpress group by post type on search page
body: <p>I would like to display search results grouped by post type. I have regular posts, pages,
  and a custom post type of product. How would I accomplish this by editing the below code.
  The code below just shows all posts and pages right now.</p>
  
  <pre><code>&lt;?php
   while (have_posts()) : the_post();  
   echo "&lt;h1&gt;";
   echo $post-&gt;post_type;
   echo $post-&gt;post_title;
   echo "&lt;/h1&gt;";
   endwhile;
   ?&gt;
  </code></pre>