<?php
// LOOP TO DISPLAY PROJECTS IN ASC. ORDER
// this sub_field is in a flexible container with a true/false type switch
if ( get_sub_field( 'project_grid') ) :
$args = array(
'post_type' => 'project',
'post_status' => 'publish',
'order' => 'ASC',
'ignore_sticky_posts' => true,
'posts_per_page' => 12
);
$projects = new WP_Query( $args );
if ( $projects->have_posts() && $projects->have_posts() ) : ?>
<section class="project-grid">
<div class="row">
<?php while ( $projects->have_posts() ) : $projects->the_post(); ?>
<div class="project-col col-lg-3 col-md-6 col-sm-12">
<div class="">
<strong><?php echo $projects->post_title; ?></strong>
<a class="post-thumbnail" href="<?php the_permalink(); ?>" aria-hidden="true" tabindex="-1">
<?php
if ( has_post_thumbnail() ) :
the_post_thumbnail( 'project-thumb', array(
'alt' => the_title_attribute( array(
'echo' => false
) )
) );
else :
echo '<img width="600" height="500" src="' . esc_url( 'https://via.placeholder.com/600x600/ddd/666.png?text=No+Project+Media', 'understrap' ) . '" alt="' . esc_attr__( 'Blank Profile Picture', 'understrap' ) . '" />';
endif;
?>
</a>
</div>
</div>
<?php endwhile; wp_reset_postdata(); ?>
</div><!-- /.row -->
</section><!-- /.staff-grid -->
<?php endif; ?>
<?php else: ?>
<h1>NO PROJECT GRID SELECTED</h1>
<?php endif;
wp_reset_postdata();
?>