I was excited to try the code found on the page you referred to. After trying it out, it still did not work. This is the code I used with my field name substituted in…it’s been inserted under the word “Profile”:
<?php $author_id = get_the_author_meta( 'ID' ); $author_badge = get_field('donor_image1', 'user_'. $author_id ); // image field, return type = "Image Object" ?> <img src="<?php echo $author_badge['url']; ?>" alt="<?php echo $author_badge['alt']; ?>" width="200" height="100" />
Keep in mind that this isn’t for an actual post page but is for an author page (author.php). The url is http://choochooclan.com/surrogate/author/egglady/ or http://choochooclan.com/surrogate/?author=11 Given that the author ID is 11, I would think that the code would pull that in dynamically and then look for the appropriate image field which is donor_image1 and then display it accordingly. As you can see this is not happening. Is there something else I need to add to the code?
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!
© 2022 Advanced Custom Fields.