Advertisement
Guest User

Untitled

a guest
Jul 6th, 2015
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. $images =& get_children( 'post_type=attachment&post_mime_type=image&post_parent=' . $postID );
  2. $attachment_id = $images[0]->ID;
  3.  
  4. $images =& get_children( 'post_type=attachment&post_mime_type=image&post_parent=' . $postID );
  5. $attachment_id = $images[0]->ID;
  6.  
  7. $attachments = get_children( array(
  8. 'post_parent' => get_the_ID(),
  9. 'post_type' => 'attachment',
  10. 'numberposts' => 1, // show all -1
  11. 'post_status' => 'inherit',
  12. 'post_mime_type' => 'image',
  13. 'order' => 'ASC',
  14. 'orderby' => 'menu_order ASC'
  15. ) );
  16. foreach ( $attachments as $attachment_id => $attachment ) {
  17. echo wp_get_attachment_image( $attachment_id );
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement