0

I created a form for edit author with "WP User Frontend" and I use a custom meta field for multi upload images that can upload 6 images, with meta name 'management_certi'. My problem is I can display first image uploaded, but can't display all of the images uploaded from its form for author. My code is:

if ( get_the_author_meta( 'management_certi', $curauth->ID ) ) { 
    $id = get_the_author_meta( 'management_certi', $curauth->ID ); 
    $url = wp_get_attachment_url( $id ); 
    ?><a href="<?php echo $url; ?>" data-lightbox="image-1" data-title=""><img src="<?php 
        echo $url; ?>" class="thumbnail" width="36" height="36" /></a><?php 
}

Any ideas?

0

I found it :D Yeeeeeeeeaaaahhhhhh :))))
This is final code that worked! I explained each level ;)

/* for get author ID use these */
$curauth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author));
$author_id = get_the_author_meta('ID');

/* First condition */
if( get_the_author_meta('management_certi', $author_id, true)) {
    /* get file ID */
    $id = get_user_meta( $author_id, 'management_certi');

    if($id) {
        /* Array Loop! */
        foreach($id as $attachments) {
            /* get file URL */
            $url = wp_get_attachment_url( $attachments ); ?>
            <a href="<?php echo $url; ?>" data-lightbox="image-1" data-title=""><img src="<?php echo $url; ?>" class="thumbnail" width="36" height="36" /></a>
        <?php
        }
    }
} else { echo '--'; }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.