WordPress.org

Forums

Image ACF in Current Author Page (1 post)

  1. flotaki
    Member
    Posted 1 year ago #

    Hello
    I need help on one problem. I created a Image Custom field in the User profile. In the Author Page, I can't succeed displaying the image. I tried many things without success. This is my code now :

    <?php get_header(); ?>
    
    <?php
    $curauth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author));
    ?>
    			<div id="primary">
    			<div id="content" role="main">
    			<div id="profil">
    			<p>Etage <?php echo $curauth->etage; ?> Atelier <?php echo $curauth->numero_datelier; ?></p>
    			<h1 class="entry-title"><p><?php echo $curauth->display_name; ?></p></h1>
    			<p><?php echo $curauth->designation; ?></p>
    		<p><?php echo $curauth->description; ?></p>
    
    <?php
    $author_id = get_the_author_meta( 'ID' );
    $image_resident = get_field('image_resident', 'user_'. $author_id ); // image field, return type = "Image Object"
    
    ?>
    <img src="<?php echo $image_resident['url']; ?>" alt="<?php echo $image_resident['alt']; ?>" />
    
    			<p><a>user_url; ?>"><?php echo $curauth->user_url; ?></a></p>
    			<p><a>user_email; ?>"><?php echo $curauth->user_email; ?></a></p>

    Everything works (some are custom fields) except the Image.
    Any idea ?
    Thank you.
    f

Topic Closed

This topic has been closed to new replies.

About this Topic