628, 'post_type' => 'attachment' )); if ( empty($attachments) ) { // no attachments here } else { foreach ( $attachments as $attachment_id => $attachment ) { echo wp_get_attachment_link( $attachment_id ); } } ?>