Images to be placed after two posts?

I am trying to put an different images in the post list articles page, where I will be having 10 posts to show on home page, after each two articles I need to place one image for one section and another image on another section. I have tried to modify the code but no luck. Below is my modified code which I am trying it:

<?php if ( hu_is_checked('blog-standard') ): ?>
<?php while ( have_posts() ): the_post(); ?>
<?php get_template_part('content-standard'); ?>
<?php endwhile; ?>
<?php else: ?>
 <div id="grid-wrapper" class="post-list group">
<?php global $wp_query; echo '<div class="post-row"><img 
 src="" style="z-
  index:9999;border:5px solid #e2e2e2;box-shadow: 10px 10px 5px 
  #888888;"/>'; while ( have_posts() ): the_post(); ?>
    <?php get_template_part('content'); ?>
  <?php if( ( $wp_query->current_post + 1 ) % 2 == 0 ) { echo '</div><div 
  class="post-row"><img src="
  content/uploads/2017/05/Portea2.png" style="z-index:9999;border:1px solid 
  #e2e2e2;"/>'; }; endwhile; echo '</div>'; ?>
  <?php endif; ?>

  <?php get_template_part('parts/pagination'); ?>

Can anyone suggest where I am going wrong.

Read more here: Images to be placed after two posts?

Leave a Reply

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