Home › Forums › Add-ons › Gallery Field › Accessing images in a gallery on user profile from PHP › Reply To: Accessing images in a gallery on user profile from PHP
@markargent could this help, How to get value from a user, ACF docs
<?php
/**
* get current author, use this on single page
*/
$author_id = get_the_author_meta('ID');
$author_image = get_field( 'author_image', 'user_'.$author_id );
$author_image_size = 'medium';
?>
<?php if( get_field( 'your_field_image', 'user_'.$author_id ) ) : ?>
<?php the_field( 'your_field_image', 'user_'.$author_id ); ?>;"
<?php endif; ?>>
<!-- get just img with wp_get_attachment -->
<?php echo wp_get_attachment_image( $author_image['ID'], $author_image_size,"", array( "class" => "custom-class-name" ) ); ?>
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!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.