public function get_attachment_ids()
{
static $attachments = array();
$post_id = get_the_ID();
if (!isset($attachments[$post_id])) {
$attachments[$post_id] = get_posts(array('post_type' => 'attachment', 'post_parent' => $post_id, 'orderby' => 'ID', 'fields' => 'ids'));
}
return $attachments[$post_id];
}