What method would I use to show an image in between X amount of posts on category archive? [duplicate]

If you can update your theme files, just update category.php and archive.php this way:

    $counter = 0; 
    while ($the_query->have_posts()) : 

<?php if ($counter % 4 == 0) : ?>
    <div class="my-ad">my ad</div>
<?php endif; ?>

    <div class="post">
        <?php the_title(); ?>



You can also change archive/category template by your own via plugin with template_include hook.

If you can’t access your theme, use loop_start or loop_end hooks:

add_action( 'loop_start', function( $query ){
     if( $query->is_category() ){


Then place your ads between posts with js.

You can also hook to the_post or the_content, check if it on category/archive template and add your ads according global count variable