For some reason I am getting an extra <li> </li>
at the end of my queried results. How can I prevent this from happening?
<li>
<?php
$counter = 0;
$query = new WP_Query( array( 'post_type' => 'serivces' ) );
while ( $query->have_posts() ) : $query->the_post(); $counter++;
?>
<div class="col-md-4 wp4">
<h2 class="text-left"><?php the_title(); ?></h2>
<p class="text-left"><?php the_content(); ?></p>
</div>
<?php
if ($counter > 0 && $counter % 3 == 0) {
echo '</li><li>';
}
endwhile;
?>
</li>