Created
February 1, 2018 17:29
-
-
Save prestonw/f86e7491d3fc7507534c9003c63a0a6c to your computer and use it in GitHub Desktop.
Pods attachments
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ( get_post_meta( get_the_ID(), 'image_field', false ) ){ | |
$image_array = get_post_meta( get_the_ID(), 'image_field', false ); | |
} | |
if ( $image_array ) { | |
echo '<ul>'; | |
foreach ( $image_array as $image ) { | |
$class = "post-attachment mime-" . sanitize_title( $image->post_mime_type ); | |
$thumbimg = wp_get_attachment_image( $image['ID'], 'thumbnail'); | |
echo '<li class="' . $class . ' data-design-thumbnail">' . $thumbimg . '</li>'; | |
} | |
echo '</ul>'; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment