Display Multiple Images in theme template file
-
Hello,
I have created a post form with image upload field. I have allowed maximum 5 images.Now I want to display the uploaded images in my theme’s single.php
I followed your tutorial here:
https://wedevs.com/docs/wp-user-frontend-pro/frontend/showing-meta-fields-in-frontend/It works only when one image is uploaded. If the field has more than one image, it displays no image.
I have tried following code:
<?php $images = get_post_meta( get_the_ID(), 'image_upload2' ); if ( $images ) { foreach ( $images as $attachment_id ) { $thumb = wp_get_attachment_image( $attachment_id, 'full' ); $full_size = wp_get_attachment_url( $attachment_id ); printf( '<a href="%s">%s</a>', $full_size, $thumb ); } } ?>
I have also tried the shortcode:
<?php echo do_shortcode( '[wpuf-meta name="image_upload2" type="image"]' ); ?>
Regards:
RaviThe page I need help with: [log in to see the link]
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Display Multiple Images in theme template file’ is closed to new replies.