I am trying to get my loop to repeat print 6 images and then end the ul and print another 6 images and repeat.
But it keeps printing them all in the same ul which is causing the page to break.
Any way to get the loop to work properly and print it out correctly?
A link to the page is http://nerdclients.com/dev2/teena/all-pages/
Thanks in advance!
<ul class="col-lg-12">
<?php
$i=0;
if ( get_query_var('paged') ) {
$paged = get_query_var('paged');
} else if ( get_query_var('page') ) {
$paged = get_query_var('page');
} else {
$paged = 1;
}
$args = array('post_type' => 'array-portfolio', 'posts_per_page' => 1000, 'paged' => $paged );
$temp = $wp_query;
$wp_query = null;
$wp_query = new WP_Query();
$wp_query->query( $args );
while ($wp_query->have_posts()) : $wp_query->the_post();
$i++;
if ($i%6==0){
$class='last';
}
else {
$class='';
}
?>
<li class="col-lg-2"<?php echo $class; ?>><a class="port-image" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_post_thumbnail( 'port-image' ); ?></a></li>
<?php endwhile; ?>
</ul>
<?php
$wp_query = null;
$wp_query = $temp; // Reset
?>