User profile

This topic contains 1 reply and 2 voices, and was last updated by Tareq Hasan 10 years, 12 months ago
Viewing 1 Posts - 1 through 1 (of 1 total)
Author Posts
April 3, 2013 at 1:55 pm 1747
Tareq Hasan I wonder how can I call custom field images for an author page in my theme template? I'm trying to make a simple gallery for each user and I just can't figure out how to call the images. I checked from the database and it seems that the Image Upload field is saving the images as id's instead of  paths. Could you please help me out a little.   -Tuomas
April 5, 2013 at 7:02 am 1816
Tareq Hasan Tareq Hasan

Sorry, didn’t noticed the post. You can use this snippet to display images from a user custom meta field. You’ve provide the user ID and meta key name here.
[php]
$images = get_user_meta( $user_id, ‘mey_key_name’ );
 
if ($images) {
    foreach ($images as $attachment_id) {
        $thumb = wp_get_attachment_image( $attachment_id, ‘thumbnail’ );
        $full_size = wp_get_attachment_url( $attachment_id );
 
        printf( ‘<a href="%s" rel="nofollow">%s</a>’, $full_size, $thumb );
    }
}
[/php]

Viewing 1 Posts - 1 through 1 (of 1 total)