Home › Forums › General Issues › User Name Field – Display Name Only › Reply To: User Name Field – Display Name Only
Hi elliot, I am attempting to do the same thing, but the username field is part of a Repeater. So it is an array within an array!
Very new to WordPress (though have been kicking goals the last few days!) – can you give me a possible example I can work from?
Obviously the code below is dodge, but show you what i am trying to do. My repeater is ‘notes_added’, it contains a sub-field ‘user_meta’ which currently spits out an array of all user meta information, like ashley described. It also has a sub-field ‘note_text’ – not an array and requires no filtering. I only want to display the NICKNAME of the user on the page, in a table cell.
<?php
if(get_field('notes_added')): ?>
<h1>Notes</h1>
<table>
<?php while(has_sub_field('notes_added')): ?>
<tr><td><?php the_sub_field('user_meta', 'nickname'); ?></td> <td><?php the_sub_field('note_text'); ?></td></tr>
<?php endwhile; ?>
</table>
<?php endif; ?>
Hope you can help, thanks.
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!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.