[Solved] Insert html after certain amount of posts?


You could use the following and it should do exactly what you want by checking the value of $loop->current_post.

<?php $loop = new WP_Query( array( 'post_type' => 'work','posts_per_page' => '-1' ) ); ?>
<ul id="carousel">
    <li>
        <ul class="inner-items">
        <?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
    <?php if( $loop->current_post  && !($loop->current_post % 6)  ) : ?>
      </ul>
  </li>
  </li>
      <ul class="inner-items"> 
    <?php endif; ?>
            <li>
                <?php the_content(); ?>        
                <?php the_post_thumbnail( 'work-thumb' ); ?>
            </li>
        <?php endwhile; ?>
        </ul>
    </li>
</ul>

2

solved Insert html after certain amount of posts?