I have this piece of code thats pulling through a custom post type clients...
<div class="wrap" style="padding-top: 0 !important;">
<?php
$args = array(
'post_type' => 'short_courses',
// 'orderby' => 'none',
'course_type' => 'digital-marketing'
);
$the_query = new WP_Query( $args );
?>
<?php if ( have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<div class="one-third course-item">
<a href="<?php the_permalink(); ?>">
<p><img src="<?php the_field('listing_thumbnail'); ?>"></p>
<h4><?php the_title(); ?></h4>
<p style="color: #f08464;"><?php the_field('date_for_thumbnail_listing'); ?></p>
<p><?php the_field('price'); ?></p>
<a href="<?php the_permalink(); ?>" class="sc-box-button" style="background-color: #f08464; margin-bottom: 40px;">MORE INFO</a>
</a>
</div>
<?php $products_count = $the_query->current_post + 1; ?>
<?php if ( $products_count % 4 == 0): ?>
<?php endif; ?>
<?php endwhile; wp_reset_postdata(); endif; ?>
</div>
All working great, but with the bit at the bottom:
<?php $products_count = $the_query->current_post + 1; ?>
<?php if ( $products_count % 4 == 0): ?>
I'm trying to get the items to flow onto the next line after 4 items... currently it's doing it after 3 items...
Apologies if it's something simple I'm missing!!!
***** UPDATE FIXED ******
Sorry - I had achieved this effect with CSS, apologies but it was just down to me changing the CSS element to:
@media (min-width: 576px) {
.card-columns {
column-count: 4; }
}