Skip to content

Instantly share code, notes, and snippets.

@spigotdesign
Created February 26, 2015 00:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save spigotdesign/7b96f382ddf1cfa76a45 to your computer and use it in GitHub Desktop.
Save spigotdesign/7b96f382ddf1cfa76a45 to your computer and use it in GitHub Desktop.
Extracting data from User field, within a repeater (ACF)
<section class="member-list">
<?php if( have_rows('repeater_field') ): ?>
<?php while ( have_rows('repeater_field') ) : the_row(); ?>
<?php $user = get_sub_field('user_field'); ?>
<?php $userID = array_values($user)[0]; ?>
<?php $first_name = get_user_meta($userID, 'first_name', true); ?>
<?php $last_name = get_user_meta($userID, 'last_name', true); ?>
<div class="member">
<h2><?php echo $first_name . ' ' . $last_name; ?></h2>
</div>
<?php endwhile; ?>
<?php endif; ?>
</section>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment