Вывод анонсов в архиве
В архиве выводятся посты в три колонки. Стоит задача - чтобы каждый третий блок с анонсом имел свой стиль . Т.е: (1 анонс с margin-right=10px)(2 анонс с margin-right=10px)(3 анонс с margin-right=0) и так далее. Имеется следующий код:
<?php $postcount = 0; ?>
<?php $j=0; $i =0; if (have_posts()) : while (have_posts()) : the_post(); $postcounter++; ?>
<?php $postcount++; ?>
<div style="box-shadow: 0 8px 10px -5px #e9e9e9;border: solid 1px #f1f1f1; position: relative;height:380px;float:left;display: block;max-width:calc(30% + 10px);margin: 5px 15px 15px 15px; background:#fff;">
<article class="<?php echo 'pexcerpt'.$i++?> post excerpt <?php echo (++$j % 2 == 0) ? 'last' : ''; ?>">
<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>" rel="nofollow" id="featured-thumbnail11archive">
<?php if ( has_post_thumbnail() ) { ?>
<?php echo '<div class="featured-thumbnail11archive">'; the_post_thumbnail(array(536,350)); echo '</div>'; ?>
<?php } else { ?>
<div class="featured-thumbnail11archive">
<img src="<?php echo get_template_directory_uri(); ?>/images/nothumb.png" class="attachment-featured wp-post-image" alt="<?php the_title(); ?>">
</div>
<?php } ?></a>
<div id="hed131v"> <h3>
<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>" rel="bookmark"><?php the_title(); ?></a>
</h3>
<?php twentyseventeen_entry_footer(); ?>
<p style="margin-top:5px;color: #8D8D8D;"><?php echo mts_excerpt(15);?>
</p>
</div>
</article><div class="post-info"><div style="float:left; height:12px; padding:0px 4px 0 0;margin-top:2px;"><img src = "http://poweredhouse.ru/wp-content/img/viewred.png"></div><div style="float:left;"><?php echo getPostViews(get_the_ID()); ?></div></div>
</div>
<?php if($postcount==3){ ?>
<? } ?>
<?php endwhile; else: ?>
<div class="no-results">
<h5><?php _e('No results found. We apologize for any inconvenience, please hit back on your browser or use the search form below.', 'mythemeshop'); ?></h5>
<?php get_search_form(); ?>
</div><!--noResults-->
<?php endif; ?>