title: Display CPT ordered by Custom Field
body: <p>I suspect this is easy, but I seem to be getting confused I think.  </p>
  
  <p>Basically I have a Custom Post Type, and Advanced Custom Fields for the content of each.</p>
  
  <p>I need to now loop through one of the Custom Fields (resource_type), and display each post that has ticked that field, displaying them under a heading.</p>
  
  <p>So it would display like:</p>
  
  <p><strong>resource_type 1</strong>   (Custom Field)</p>
  
  <ul>
  <li>Resource 1   (Post that has ticked resource_type 1 ACF)</li>
  <li>Resource 2   (Post that has ticked resource_type 1 ACF)</li>
  <li>Resource 3   (Post that has ticked resource_type 1 ACF)</li>
  </ul>
  
  <p><strong>resource_type 2</strong>    (Custom Field)</p>
  
  <ul>
  <li>Resource 4    (Post that has ticked resource_type 2 ACF)</li>
  <li>Resource 5    (Post that has ticked resource_type 2 ACF)</li>
  </ul>
  
  <p>I've searched around but can't see anything specifically for this.</p>
  
  <p>this is what I have so far:</p>
  
  <pre><code>$cat = get_field('resource_type'); 
      foreach ($cat as $catVal) {
          echo '&lt;h2 style="color: #8D8B8D;"&gt;'.$catVal.'&lt;/h2&gt;&lt;ul&gt;';
          $postArg = array('post_type'=&gt;'resources',
            'search_filter_id' =&gt; '13180'
            );
  
          $getPost = new wp_query($postArg);
          global $post;
            while ( $getPost-&gt;have_posts()):$getPost-&gt;the_post(); ?&gt;
                &lt;li&gt;&lt;a href="&lt;?php the_permalink(); ?&gt;"&gt;&lt;?php 
  the_title(); ?&gt;&lt;/a&gt;&lt;/li&gt;
            &lt;?php endwhile; 
          echo '&lt;/ul&gt;';
      }
  </code></pre>