Is it possible to add some html after a set amount of posts?
For the purposes of a slider after 6 posts i need it to enclose in a div/li or whatever then start a new div/li for the next 6 and so on.
Here is my custom query which just prints the post name in a list.
<ul>
<?php $args=array('post_type' => 'courses','post_status' => 'publish','posts_per_page' => -1);$my_query = null;$my_query = new WP_Query($args);if( $my_query->have_posts() ) {while ($my_query->have_posts()) : $my_query->the_post(); ?>
<li><h2><?php the_title(); ?></h2></li>
<?php endwhile;} wp_reset_query();?>
</ul>
After at the start and end of 6 posts i need to open a div then close it after the 6th post.
Is this possible with WordPress PHP?
Many thanks for any help :)