I am creating a special page to show up all the authors and contributors for a website. I'm using ACF fields for the users and these fields are not showing up.
According to ACF support, I should use this:
<?php
$author_id = get_the_author_meta('ID');
$author_badge = get_field('author_badge', 'user_'. $author_id );
?>
<img src="<?php echo $author_badge['url']; ?>" alt="<?php echo $author_badge['alt']; ?>" />
My code at the moment is:
<?php
foreach($users as $user)
{
?>
<div class="s-12 l-4 margin-bottom">
<div class="theBox">
<figure class="effect-zoe">
<p><?php echo get_the_author_meta( $userID ); ?></p>
<?php
$author_id = get_the_author_meta('ID');
$author_badge = get_field('author_badge', 'user_'. $author_id );
?>
<img src="<?php echo $author_badge['url']; ?>" alt="<?php echo $author_badge['alt']; ?>" />
<figcaption>
<p><a href="<?php echo get_author_posts_url( $user->ID ); ?>">view profile</a></p>
</figcaption>
</figure>
<h3><?php echo $user->display_name; ?></h3>
</div>
</div>
<?php
}
?>
Only the ACF field is not working. Any tip on how to fix it?
One more thing: If I use this: <?php the_field('field_name', 'user_1'); ?>
works! But this is not what I want, once I need to show a list of users with their respective ACF fields filled.