Guest User

Untitled

a guest
Jul 15th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. <?php
  2. $imgargs = array('post_type' => 'attachment','post_mime_type' => 'image','numberposts' => -1,'order' => 'ASC','post_status' => null,'post_parent' => $post->ID );
  3. $attachments = get_posts($imgargs);
  4. if ($attachments) {
  5. foreach ($attachments as $attachment) { $img = wp_get_attachment_thumb_url( $attachment->ID );
  6. break; }
  7. } ?>
  8. <img src="<? echo $img ?>" alt="" />
Add Comment
Please, Sign In to add comment