Skip to content

Instantly share code, notes, and snippets.

@tripflex
Created April 7, 2015 01:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tripflex/0edc7c9a7720ed5c301b to your computer and use it in GitHub Desktop.
Save tripflex/0edc7c9a7720ed5c301b to your computer and use it in GitHub Desktop.
Output multiple image thumbnails from multi-file upload
$images = get_custom_field( 'job_multifile' );
if ( is_array( $images ) && ! empty( $images ) ){
foreach( $images as $image ){
$thumbnail_id = get_attachment_id_from_url( $image );
$thumbnail = wp_get_attachment_thumb_url( $thumbnail_id );
echo "<a href=\"{$image}\"><img src=\"{$thumbnail}\"></a>";
}
} elseif( ! empty( $images ) ){
$thumbnail_id = get_attachment_id_from_url( $images );
$thumbnail = wp_get_attachment_thumb_url( $thumbnail_id );
echo "<a href=\"{$images}\"><img src=\"{$thumbnail}\"></a>";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment