WP loops are widely used to print lists of posts in Wordpress:
<?php $loop = new WP_Query( array( 'post_type' => 'ff', 'ff' => 'show_ff', 'orderby' => 'menu_order', 'order' => 'ASC' )); while ( $loop->have_posts() ) : $loop->the_post(); ?> <!-- here we're going to have all posts from show_ff category of ff type. --> <?php endwhile; ?>
Is there a way of displaying for example 3 first posts then some element (div in my case) and again 3 next posts?
I know I could do 6 loops in each div, but maybe there's another way of breaking this code? Maybe some if loops inside of while loop? Here's my concept:
(...) while ( $loop->have_posts() ) : $loop->the_post(); echo '3 first posts'; echo '<div class="special"></div>'; echo '3 last posts'; endwhile; ?>