title: How to store while loop results in 2 arrays depending on post type in wordpress
body: <p>My while loop is getting 2 different custom post types.  I want them to be displayed as follows:</p>
  
  <p><strong>My Custom Posts 1</strong></p>
  
  <p>custom post id1</p>
  
  <p>custom post id2</p>
  
  <p>custom post id3</p>
  
  <p><strong>My Custom Posts 2</strong></p>
  
  <p>custom post id4</p>
  
  <p>custom post id5</p>
  
  <p>custom post id6</p>
  
  <p>In order to get that second heading in though, I need to break out of the while loop otherwise it'll run it for every post.  So I was thinking if I run the while loop and store each item in an array based on it's custom posts type.  So if custom posts type 1 store in array 1, if custom post type 2 store in array 2.  I'd then do a foreach loop for each array so I could put my heading before.  </p>
  
  <p>Does this sound the most efficient way?  Also, how do I get the array contents, I mean I'm not sure what is stored.  I know using wp function the_title(), I can get the title of the post.  Would this work using the array i.e.</p>
  
  <pre><code>foreach ($customPosts1 as $customPost1)  {
      the_title();
      the_content()
  }
  </code></pre>
  
  <p>I also need to know how to check it's post type and what I actually store in the array.  i.e. array_push($customPosts1,?)</p>