title: How to increment posts within a specific category for every 6 posts of all categories
body: <p>I am successfully returning a post from the 'CTA' category every 6 posts on the page. However every time the loop is run I get stuck with the first post in the array instead of the incremental progression of all the CTA posts. </p>
  
  <p>I've tried returning the posts by RAND order and that worked better but did have repeats. I don't seem to be able to get the count set for the CTA category after already setting a counter for every six posts. </p>
  
  <pre><code>&lt;?php if ( $query-&gt;have_posts() ) {  ?&gt;
  
      &lt;?php while ($query-&gt;have_posts()) {
  
           if( $query -&gt; post_count &gt; 0 ) {
  
                   $postnum = 0;
  
           foreach( $query -&gt; posts as $post ) {
  
                    $postnum++;
  
                    if( $postnum%5 == 0 ) {
  
                      $args = array( 'cat' =&gt; 1824, 'posts_per_page' =&gt; 1, );
                      query_posts( $args );
                      $current_post = 0;
                      while ( have_posts() ) : the_post();
                          $current_post++;
  
                          echo "CTA Card Specific Info";
                      endwhile;
  
                  }
  
                  $query-&gt;the_post();
  
  
              ?&gt;
  </code></pre>