Bootstrap Wordpress theme dev - How to use WP loop to generate span6 in a span12 layout

情到浓时终转凉″ 提交于 2019-12-07 01:03:35

What I usually do in a situation like this is using a $counter variable. Place this after your the_post();

<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<div class="post">
<?php
    //echo post here
    the_title();
    the_content();
?>

</div> <!-- close .post div -->

<?php
    $counter++;
    if ($counter % 2 == 0) {
    echo '<div style="clear:both;"></div>';
    }
?>


<?php endwhile; else: ?>
    <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
<?php endif; ?>

The CSS you'd use for the code above would be:

.post{
    float:left;
    width:300px; /* width of the post */
}

I assume that's what you're looking for?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!