Change front-page layout after x amount of posts ( while in the same loop)
I'm trying to change the layout of my front-page after x amount of posts, then returning to the original layout as shown in the image below.
?php
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
$query = new WP_Query(
array(
'posts_per_page' = 7,
'paged' = $paged
)
);
if ( $query-have_posts() ) : ?
div // container 1
div //container 2
?php
$count = 1;
while ( $query-have_posts() ) : $query-the_post();
?
?php echo the_post_thumbnail(); ?
?php echo get_the_title(); ?
?php if ( 3 === $count) { ?
/div // close container 2
/div // close container 1
?php } ?
?php if ( 4 = $count) { ?
// put new layout here
?php } ?
?php if ( 6 = $count) { ?
// return to original layout
?php }
$count++;
endwhile;
endif; ?
This is a simplification of the code I currently have. Hope this question is easy to understand!
the dark grey represents new sections
Topic screen-layout loop Wordpress
Category Web