I would a bit more detail (or your starting code ) to see where you’re putting this or how you want to use it but from what I see you need to add a counter to your iteration and then use a modulo operator:
a sample query would look like this though:
$winnners_query = new WP_Query(array(
'post_type' => 'post',
'posts_per_page' => '10',
));
if ($winnners_query->have_posts()) {
$i=1;
$section=1; //section counter
$count = $winnners_query->found_posts; //total post count
echo '<section class="side" data-role="side" id="section-section'.$section.'">'; //adds first section (you need to add css to style)
while ($winnners_query->have_posts()) {
$winnners_query->the_post();
echo '<div class="content">'.get_the_title().'</div>'; //adds content you need to add css styles
if ( $count == $i) {
//we're on the last post of the query. Close section
echo '</section>';
} else {
if ($i % 2) { //if iteration is even increase section count, close section and open a new one
$section++;
echo '</section><section class="side" data-role="side" id="section-section'.$section.'">';
}
$i++;
}
}
wp_reset_postdata();
}