All Approved User Images

'user_images', 'post_status' => 'publish' ); $posts = new WP_Query($args); if($posts->post_count){; $out = ''; $out .= ''; $out .= ''; foreach($posts->posts as $user_image){ $user_info = get_userdata($user_image->post_author); $user_image_cats = get_the_terms($user_image->ID, 'sui_image_category'); foreach($user_image_cats as $cat){ $user_image_cat = $cat->name; } $post_thumbnail_id = get_post_thumbnail_id($user_image->ID); $out .= ''; $out .= ''; $out .= ''; $out .= ''; $out .= ''; $out .= ''; } $out .= '
ImageCaptionCategoryPosted By
' . wp_get_attachment_link($post_thumbnail_id, 'thumbnail') . '' . $user_image->post_title . '' . $user_image_cat . '' . $user_info->user_login . '
'; echo $out; }else{ echo 'No images have been approved for publication!'; } ?>