Skip to content

Instantly share code, notes, and snippets.

@themeblvd
Last active February 3, 2017 23:12
Show Gist options
  • Save themeblvd/bbbf8842985ac6b00eaf3343f25bb4cb to your computer and use it in GitHub Desktop.
Save themeblvd/bbbf8842985ac6b00eaf3343f25bb4cb to your computer and use it in GitHub Desktop.
<?php if ( $other_properties_query->have_posts() ) : ?>
<?php
$counter = 1; // Start counter at 1.
$total = $other_properties_query->post_count; // Set total number of posts.
?>
<h2>Under Construction</h2>
<?php themeblvd_open_row(); // Open first row before starting loop. ?>
<?php while ( $other_properties_query->have_posts() ) : ?>
<?php $other_properties_query->the_post(); ?>
<div class="grid-item col-sm-6">
<article <?php post_class(); ?>>
<div class="featured-item featured-image">
<a href="<?php echo esc_url( get_permalink() ); ?>">
<?php the_post_thumbnail( 'tb_grid' ); ?>
</a>
</div><!-- .featured-item -->
<div class="title">
<?php the_title(); ?> - $<?php echo number_format( get_field('price'), 0, '.', ',' ); ?>
</div><!-- .title -->
</article>
</div><!-- .grid-item -->
<?php if ( $counter % 2 == 0 && $total != $counter ) : // If $counter is divisible by 2 and this it NOT very last post in loop. ?>
<?php themeblvd_close_row(); ?>
<?php themeblvd_open_row(); ?>
<?php endif; ?>
<?php $counter++; // Increment counter by 1, for the next pass through. ?>
<?php endwhile; ?>
<?php themeblvd_close_row(); // Close last row after finishing loop. ?>
<?php wp_reset_postdata(); ?>
<?php endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment