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.

    if(get_field('notes_added')): ?>
      <?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; ?>
    <?php endif; ?>

    Hope you can help, thanks.