How do you stop echo of multiple values with 'foreach' in PHP?
- by Aaron EA
How do you when using custom fields in Wordpress echo just the first value using foreach?
Currently the code is:
<?php for(get_field('venue_event') as $post_object): ?>
<a href="<?php echo get_permalink($post_object); ?>"><?php echo get_the_title($post_object) ?></a>
<?php endforeach; ?>
This takes the field from the wordpress page (the field is a link to another page), creates a link to that page using get_permalink but when I want to echo the page title it does it, but then it also echos all other values that are not needed.