Inside the wordpress loop to place an image?

Hello! There is a standard cycle for wordpress. Interested in how the inside of a standard cycle announcements (limit 7 entries)
<?php if ( $query--->have_posts() ) : while ( $query->have_posts() ) : $query->the_post(); ?>

the <li> 
 <span class="li--span"><span class="li--span--category"><?php the_category( ', ' ); ?></span></span> 
 <a href="<?php the_permalink() ?>" class="li-a"> 
 <span class="little_content"><?php the_title(); ?></span> 
 </a> 
</li>

<?php endwhile; ?>

Take a picture after 4 announcement, i.e. there should be 4 entries - picture - 3 recording after
<a href="#"><img src="<?php echo get_template_directory_uri() ?>/img/advertisement.jpg" width="300" height="500" title="go to advertiser's website"></a>
June 10th 19 at 14:58
1 answer
June 10th 19 at 15:00
Solution
<?php $i = 1; if ( $query--->have_posts() ) : while ( $query->have_posts() ) : $query->the_post(); ?>
the <li> 
 <span class="li--span"><span class="li--span--category"><?php the_category( ', ' ); ?></span></span> 
 <a href="<?php the_permalink() ?>" class="li-a"> 
 <span class="little_content"><?php the_title(); ?></span> 
 </a> 
</li>
<?php if ( $i == 4 ) { echo 'the picture'; } ?>">
<?php $i++; endwhile; ?>

Find more questions by tags ImagesWordPressHTML