I am currently using Slick Carousel to rotate through articles on my website homepage.
This currently works by using the following code:
<div class="news-slider">
<?php $i = 0; ?>
<?php $the_query = new WP_Query( 'cat=8,7,9&posts_per_page=6' ); ?>
<?php while ($the_query -> have_posts()) : $the_query -> the_post(); ?>
<?php $backgroundImg = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full' );?>
<?php if ( $i % 2 == 0) : ?>
<div class="wrap">
<?php endif; ?>
<div class="news-snippet">
<div class="news-snippet-thumbnail" style="background: url('<?php echo $edTheDev = $backgroundImg[0] ? $backgroundImg[0] : '/wp-content/themes/quantinsight/assets/img/post-thumb.png'; ?>') no-repeat center; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover;"></div>
<div class="news-snippet-content">
<h3 class="[ f-avenir-book-26 u-ColorBlue ]"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h3>
<p class="news-snippet-date"><?php echo the_time('d.m.y'); ?></p>
<p class=""><a href="<?php the_permalink() ?>">Read More</a></p>
</div>
</div>
<?php if ( $i % 2 != 0 ) : ?>
</div>
<?php endif; ?>
<?php
$i++;
endwhile;
wp_reset_postdata();
?>
</div>
Instead of display 2 articles inside a carousel wrap I now want to display 3 articles.
I thought if I changed $i % 2 to $i % 3 that this would update the articles displayed in each wrap but this breaks the carousel completely.
Any suggestions on I am missing would be greatly appreciated.