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
<?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!
The ACF site is currently experiencing some issues.— Advanced Custom Fields (@wp_acf) September 29, 2022
We apologize for the inconvenience and we are working hard to get it back up and running as soon as possible.
© 2022 Advanced Custom Fields.