Home Forums Plugin Support WP User Frontend Pro User profile

This topic is: resolved

Tagged: , ,

This topic contains 1 reply, has 2 voices, and was last updated by  Tareq Hasan 6 years, 1 month ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1747

    dukens
    Participant
    Post count: 3

    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

    #1816

    Tareq Hasan
    Keymaster
    Post count: 2831

    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 2 posts - 1 through 2 (of 2 total)

The topic ‘User profile’ is closed to new replies.