This topic could not help me
https://wordpress.org/support/topic/how-to-modify-loop-to-split-posts-into-groups-of-threes?replies=12#post-1604900
please write loop for this html:
each post has different style in loop.
`
<ul>
<li>
<div class=post-style-one></div>
<div class=post-style-tow></div>
<div class=post-style-three></div>
</li>
<li>
<div class=post-style-one></div>
<div class=post-style-tow></div>
<div class=post-style-three></div>
</li>
</ul>
what theme are you using?
what is the original code of your loop (index.php ?) ?
im use for slider.
my code:
<ul>
<!--start loop -->
<li>
<!--posts % 3 == 0 -->
<div class="big-slide">
<a href="<?php the_permalink(); ?>">
alt="<?php the_title(); ?>" width="638" height="320" style="width: 638px; height: 320px;">
</a>
</div>
<!--posts % 3 == 1-->
<div class="small-slide">
<a href="<?php the_permalink(); ?>">
alt="<?php the_title(); ?>" width="312" height="157" style="width: 312px; height: 157px;">
</a>
</div>
<!--posts % 3 == 2-->
<div class="small-slide">
<a href="<?php the_permalink(); ?>">
alt="<?php the_title(); ?>" width="312" height="157" style="width: 312px; height: 157px;">
</a>
</div>
</li>
</ul>
<!--end loop -->
this is the combination of your code with the code from https://wordpress.org/support/topic/how-to-modify-loop-to-split-posts-into-groups-of-threes?replies=12#post-1604900, based on the default loop and query.
needs to be adapted if you are using a custom query to get the slides…
<ul>
<!--start loop -->
<!-- open starting li before loop -->
<li>
<?php while( have_posts() ) : the_post(); ?>
<div class="<?php echo( $wp_query->current_post % 3 == 0 ? 'big' : 'small' ); ?>-slide">
<a href="<?php the_permalink(); ?>">
<img src="" alt="<?php the_title_attribute(); ?>" width="638" height="320" style="width: 638px; height: 320px;">
</a>
</div>
<?php $current_position = $wp_query->current_post + 1; // current_post starts at 0
if( $current_position < $wp_query->found_posts && $current_position % 3 == 0 ) : ?>
<!-- if position is equal to the divider and not the last result close the currently open div and start another -->
</li>
<?php echo "\n"; ?>
<li>
<?php endif; ?>
<?php endwhile; ?>
</li>
<!-- close whichever li was last open -->
</ul>
<!--end loop -->
Thank You;
How do I use every time the loop is just a series of custom post?
for examle:
<li>
custom post 1
</li>
<li>
custom post 2
</li>
<li>
custom post 3
</li>