WordPress.org

Support

Support » Themes and Templates » Alternating div's for posts

Alternating div's for posts

  • I have my page setup with the typical <?php if(have_posts()) : while(have_posts()) : the post() ?><?php endwhile; endif; ?> but I have a two DIV’s inside this loop that needs to alternate. How could I do this with as little as code as possible.

Viewing 1 replies (of 1 total)
  • Current code. I want to show 2 posts per row.

    <?php if(have_posts()) : while(have_posts()) : the_post(); ?>
        <div class="posts">
            <div class="row">
                <div class="first">
                   <h2><?php the_title(); ?></h2>
                   <?php the_content(); ?>
                </div>
                <div class="second">
                   <h2><?php the_title(); ?></h2>
                   <?php the_content(); ?>
                </div>
            </div>
        </div>
    <?php endwhile; endif; ?>

Viewing 1 replies (of 1 total)
  • The topic ‘Alternating div's for posts’ is closed to new replies.
Skip to toolbar