-
-
Save jquimera/ee07c7d20b6c2d8a8251d33996153855 to your computer and use it in GitHub Desktop.
WP Query loop - in multiples of 3 posts in containing div.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$currentID = get_the_ID(); | |
$featured = new WP_Query(array( | |
'post_type' => 'post', | |
'order' => 'DESC', | |
'posts_per_page' => 8, | |
'post__not_in' => array($currentID) | |
)); ?> | |
<?php $i=1; if ($featured->have_posts()) : ?> | |
<div id="slider-wrapper"> | |
<?php while ($featured->have_posts()) : $featured->the_post(); if ($i==1 || $i%3==1) echo '<div class="slide-group">'; ?> | |
<div class="slide"> | |
<?php the_title(); ?> | |
</div> | |
<?php if($i%3==0) echo '</div>'; $i++; endwhile; ?> | |
</div> | |
<?php unset($featured); endif; wp_reset_query(); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment