Images to be placed after three posts

Hi I want to place an image at the fifth position while displaying the articles in home page. Say I have set the posts to display 14 in home page and the fifth and tenth position the same image has to be placed in between the posts. Below is the code I am modifying it.

<?php if( ( $wp_query->current_post + 1) % 2 == 0 ) { echo '</div><div class="post-row"><article id="post-777" class="group grid-item post-777 post type-post status-publish format-standard has-post-thumbnail hentry category-health-media">
<div class="post-inner post-hover">

    <div class="post-thumbnail"><img width="520" height="245" 
    class="attachment-thumb-medium size-thumb-medium wp-post-image" alt="" 
    content/uploads/2017/05/shutterstock_137498780-520x245.jpg 520w,
    720x340.jpg 720w" sizes="(max-width: 520px) 100vw, 520px"></div></div>
    </article>'; }; endwhile; echo '</div>'; ?>
  <?php endif; ?>

Can you suggest where I am going wrong. Please help me.

Read more here: Images to be placed after three posts

Leave a Reply

Your email address will not be published. Required fields are marked *