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’re reaching out to our multilingual users to ask for help in translating ACF 6.1. Help make sure the latest features are available in your language here: https://t.co/TkEc2Exd6U— Advanced Custom Fields (@wp_acf) May 22, 2023
© 2023 Advanced Custom Fields.