Created
February 29, 2016 21:10
-
-
Save marisqaporter/c50403d5295e22b3e46f to your computer and use it in GitHub Desktop.
php loop with image as id - let's you call image size
This file contains 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 | |
$args = array( | |
'post_type' => 'volunteer-opportunit', // enter your custom post type | |
'orderby' => 'date', // order | |
'order'=> 'ASC', //reverse order | |
); | |
$loop = new WP_Query( $args ); | |
if( $loop->have_posts() ): | |
echo '<div class="row stretch-xs center-xs">'; | |
while( $loop->have_posts() ): $loop->the_post(); global $post; | |
echo '<div class="col-xs-12 | |
col-sm-12 | |
col-md-4 | |
col-lg-4 row stretch-xs">'; | |
?> | |
<div class="box staff-box volunteer-box"> | |
<!-- the image --> | |
<?php | |
$size = 'volunteer'; | |
$image = get_field('volunteer_image'); | |
if( $image ) { | |
echo wp_get_attachment_image( $image, $size ); | |
} | |
?> | |
<!-- the image --> | |
<?php the_title( '<h3>', '</h3>' ); ?> | |
</div> | |
<?php | |
echo '</div>'; //end section inner | |
endwhile; | |
echo '</div>'; //end row | |
endif; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment