I have Website with WordPress Bootstrap:
http://www.obra-93.hr/zavrseni-projekti/
I have portfolio with items per row. The code for loop 3 items per row (totaly 20 items) is below:
<div class="container">
<div class="row vrow">
<?php // slideshow
$args_projekti = array(
'showposts' => -1,
'orderby' => 'date',
'order' => 'DESC',
'no_found_rows' => true,
'post_type' => 'projekti',
'post_status' => 'publish',
'cache_results' => false,
'update_post_term_cache' => false,
'update_post_meta_cache' => false
);
$projekti = new wp_query($args_projekti);
$p=0;
if ($projekti->have_posts()):
?>
<?php
while ($projekti->have_posts()):
$projekti->the_post();
$post_id = get_the_ID();
?>
<div class="col-xs-12 col-sm-4 col-md-4">
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail('projekt-thumb', array('class' => 'img-responsive fade center-block'));?></a>
<h3 class="text-center"><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
</div>
<?php if($p%3===0){echo '</div><div class="row vrow">';} ?>
<?php $p++; endwhile; endif; wp_reset_query(); ?>
</div>
</div>
My first and last row is not working properly. Why?
Thanks!
(($p+1) % 3 === 0)$p = 1;;) Also there are a lot of similar answers and questions out there. For instance