Created
February 26, 2015 00:12
-
-
Save spigotdesign/7b96f382ddf1cfa76a45 to your computer and use it in GitHub Desktop.
Extracting data from User field, within a repeater (ACF)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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