I’m looking for a bit of help figuring out how to query the relationship field to first check if it contains more than one value, if so – i want to do one thing, if there is only 1 value, i’d like it to do another. code attached below:
<!-- COURSE FACULTY -->
<?php
global $post;
$faculty = get_field('alt_faculty');
if( $faculty ): ?>
<h3>Course Faculty</h3>
<?php foreach( $faculty as $post): ?>
<?php setup_postdata($post); ?>
<div class="post-author-wrap m-1of2 t-1of3 d-1of3 cf">
<div class="post-author cf">
<div class="thumb">
<?php if ( has_post_thumbnail() ) { ?>
<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(); ?></a>
<?php } else { ?>
<a href="<?php the_permalink(); ?>"><img src="<?php echo catch_that_image(); ?>" /></a><?php }?>
</div>
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<div class="thecontent">
<?php the_excerpt(); ?>
</div>
</div>
</div>
<?php endforeach; ?>
<?php wp_reset_postdata(); ?>
<?php endif; ?>
<!-- END COURSE FACULTY -->
you just need an else
$faculty = get_field('alt_faculty');
if ($faculty && count($faulty) == 1):
// only 1
elesif ($faculty):
// more than 1