## php – Split have_posts() by two columns

Question

I need to divide into 2 columns this loop. For example, 4 elements will go the left column, and the remaining 3-4 will go to the right column.

<?php
global $wp_query;$args = array(
'post_type' => 'faq',
'post_status' => 'publish',
'orderby' => 'title',
'order' => 'ASC',
);

$loop = new WP_Query($args);

while ($loop->have_posts()) :$loop->the_post();
?>
<h3><?php the_title(); ?></h3>
<?php
endwhile;

wp_reset_postdata();
?>


0
2 months 2022-08-09T14:04:07-05:00 0 Answers 0 views 0