Wrap every four posts within a div [duplicate]
Try this code: <?php $args = array( ‘post_type’ => ‘post’, ‘posts_per_page’ => -1, ‘orderby’ => ‘menu_order’, ‘order’ => ‘ASC’,’cat’ => ‘2’, ); $loop = new WP_Query( $args ); ?> <?php if( $loop->have_posts() ): ?> <?php $counter = 0; while ( $loop->have_posts() ) : $loop->the_post(); ?> <?php if ($counter % 4 == 0 && $counter != … Read more