Get two values from array in User field
-
Hi,
I have created a custom field in the Options page that is a User custom field type, whereby there is a select and you can choose one user from the dropdown.
The call on my template works fine (it returns the user it is supposed to), but returns the entire array of data from that user. How can I just get the display_name and the user_url from the array?
Here’s what I have got now:
<?php $values = get_field('my_field','options'); if($values) { echo '<ul>'; foreach($values as $value) { echo '<li>' . $value . '</li>'; } echo '</ul>'; } ?>
Any ideas how to retrieve just some of the values from the array?
Many thanks!
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Get two values from array in User field’ is closed to new replies.