Answer the question
In order to leave comments, you need to log in
How to wrap specific posts in a container in worpress?
<main id="content" class="site-content" role="main">
<?php if ( have_posts() ) : ?>
<?php /* The loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', get_post_format() ); ?>
<?php endwhile; ?>
<?php if ( get_next_posts_link() ) : ?>
<span class="next-page" title="Показать ещё"><?php next_posts_link( __('') ); ?></span>
<?php endif; ?>
<?php else : ?>
<?php get_template_part( 'content', 'none' ); ?>
<?php endif; ?>
</main>
Answer the question
In order to leave comments, you need to log in
<?php $iterator = 0; ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php if ($iterator < 12) { ?>
<div class="<?= $iterator < 5 ? "one-to-five-class" : "six-to-twelve-class" ?>">
<? php } ?>
<?php get_template_part( 'content', get_post_format() ); ?>
<?php if ($iterator < 12) { ?>
</div>
<?php } ?>
<?php $iterator++; ?>
<?php endwhile; ?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question