Skip to content

Instantly share code, notes, and snippets.

@kjprince
Created June 19, 2015 19:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kjprince/69569262b2cdc5c6ca63 to your computer and use it in GitHub Desktop.
Save kjprince/69569262b2cdc5c6ca63 to your computer and use it in GitHub Desktop.
3 Column Bootstrap Layout WP Posts
<div class="container my-container">
<?php
$args=array(
'post_type' => 'reviews',
'post_status' => 'publish',
'posts_per_page' => 18
);
$my_query = null;
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
$i = 0;
while ($my_query->have_posts()) : $my_query->the_post();
if($i % 3 == 0) { ?>
<div class="row">
<?php
}
?>
<div class="col-md-4">
<div class="my-inner equal-height">
<span class="glyphicon glyphicon-heart"></span>
<div itemprop"review" itemscope itemtype="http://schema.org/Review">
<p><?php the_post_thumbnail( 'thumbnail', array( 'class' => 'center-block img-circle img-responsive' ) ); ?></p>
<div class="text-center center-block">
<p class="text-center"><span itemprop="description"><?php the_content(); ?></span></p>
</div>
<?php $reviewerName = types_render_field("name", array("raw"=>"true"));?>
<p class="text-center"><b><?php echo $reviewerName; ?></b></p>
<?php $reviewerLocation = types_render_field("location", array("raw"=>"true"));?>
<p class="text-center"><span class="glyphicon glyphicon-map-marker"></span>&nbsp;<?php echo $reviewerLocation; ?></p>
<?php $reviewerLinkedIn = types_render_field("linkedin-url", array("raw"=>"true"));?>
<a href="<?php echo $reviewerLinkedIn; ?>" title="Linked Profile" target="blank" class="text-center center-block"><img src="<?php echo get_template_directory_uri() .'/assets/images/linkedin.png';?>" class="" alt="LinkedIn Icon"></a>
</div>
</div>
</div>
<?php $i++;
if($i != 0 && $i % 3 == 0) { ?>
</div><!--/.row-->
<div class="clearfix"></div>
<?php
} ?>
<?php
endwhile;
}
wp_reset_query();
?>
</div><!--/.container-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment