Home › Forums › Front-end Issues › Implode Post Object with "," and add "and" at last word › Reply To: Implode Post Object with "," and add "and" at last word
Thanks for the help @hube2
To make sure I wasn’t getting empty results, I changed the ACF to relationship and used;
<?php $locations = get_field('development_plots'); ?> <?php if( $locations ): ?> <?php foreach( $locations as $location ): ?> <span class="accent_color"><?php echo get_the_title( $location->ID ); ?></span>, <?php endforeach; ?> <?php endif; ?>
To output them, which they are but obviously want the last one to have ‘and’ at the end.
I tried the above, but that just blew it up again…
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
© 2022 Advanced Custom Fields.