我有以下代码:
<div class="container">
<div class="row">
<?php
$slider_qu= new WP_Query(array(
\'post_type\' => \'post\',
\'post_status\' => \'publish\',
\'cat\' =>\'\',
\'order\' => \'title\',
\'orderby\' => \'date\',
\'posts_per_page\' =>\'5\',
));
while ( $slider_qu->have_posts() ) : $slider_qu->the_post(); $src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), false, \'\' );
//Show the left hand side column
if($counter == 1) :
?>
<div class="col-md-3 col-sm-3 col-xs-12 pad">
<a href="<?php the_permalink() ?>" rel="bookmark" alt="<?php the_title_attribute(); ?>">
<div class="imgcontainer" style="background:<?php echo get_post_meta($post->ID, \'feature_bg\', true); ?> url(<?php echo $src[0]; ?>);" >
<div class="Details"><h2><?php the_title_attribute(); ?></h2>
<span class="Date pull-right"><?php the_time( get_option(\'date_format\') ); ?></span>
<span class="pull-left commentsNumerous" href="#"><i class="fa fa-comment"></i><?php comments_popup_link(__(\'0\'), __(\'1\'), __(\'%\')); ?></span>
</div>
</div></a>
</div>
<?php
//Show the middle column
elseif($counter == 2) :
?>
<div class="col-md-6 col-sm-6 col-xs-12 pad">
<a href="<?php the_permalink() ?>" rel="bookmark" alt="<?php the_title_attribute(); ?>">
<div class="imgcontainer" style="background:<?php echo get_post_meta($post->ID, \'feature_bg\', true); ?> url(<?php echo $src[0]; ?>);" >
<div class="Details"><h2><?php the_title_attribute(); ?></h2>
<span class="Date pull-right"><?php the_time( get_option(\'date_format\') ); ?></span>
<span class="pull-left commentsNumerous" href="#"><i class="fa fa-comment"></i><?php comments_popup_link(__(\'0\'), __(\'1\'), __(\'%\')); ?></span>
</div>
</div></a>
</div>
<?php
//Show the right hand side column
elseif($counter == 3) :
?>
<div class="col-md-3 col-sm-3 col-xs-12 pad">
<a href="<?php the_permalink() ?>" rel="bookmark" alt="<?php the_title_attribute(); ?>">
<div class="imgcontainer" style="background:<?php echo get_post_meta($post->ID, \'feature_bg\', true); ?> url(<?php echo $src[0]; ?>);" >
<div class="Details"><h2><?php the_title_attribute(); ?></h2>
<span class="Date pull-right"><?php the_time( get_option(\'date_format\') ); ?></span>
<span class="pull-left commentsNumerous" href="#"><i class="fa fa-comment"></i><?php comments_popup_link(__(\'0\'), __(\'1\'), __(\'%\')); ?></span>
</div>
</div></a>
</div>
<div class="clear"></div>
<?php endif; ?>
<?php $counter = ($counter == 3) ? 1 : ($counter + 1);
endwhile; ?>
</div></div>
其中@Howdy_McGee 写下它here 但它只在每个div中显示1个帖子,但我希望它在第一个div中显示2个帖子,然后在第二个div中显示1个帖子,在第三个div中显示另外2个帖子,这样我就可以像引导网格滑块一样this.