Created
February 13, 2014 21:57
-
-
Save emaildano/8984708 to your computer and use it in GitHub Desktop.
Bootstrap row reset query example.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Template Name: Trainers Template | |
*/ | |
?> | |
<div class="trainers-grid"> | |
<?php | |
$args = array( | |
'post_type' => 'trainers', | |
'posts_per_page' => -1, | |
); | |
$wp_query = new WP_Query( $args ); | |
if ( $wp_query->have_posts() ) : ?> | |
<div class="row trainers-grid-row"> | |
<?php $count=0; ?> | |
<?php while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?> | |
<div class="col-sm-4 trainers-thumbnail"> | |
<?php | |
if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it. | |
the_post_thumbnail('full', array('class' => 'img-responsive')); | |
} | |
?> | |
<div class="title"><?php the_title(); ?></div> | |
</div> | |
<?php $count++; ?> | |
<?php if ($count==3 ||$wp_query->found_posts==0) : ?> | |
</div> | |
<div class="row trainers-grid-row"> | |
<?php $count=0; ?> | |
<?php endif; ?> | |
<?php endwhile; ?> | |
<?php else : ?> | |
<h3>Sorry but there are no portfolio items.</h3> | |
<?php endif; ?> | |
<?php wp_reset_query(); ?> | |
</div> | |
</div><!-- trainers-grid --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment