<?php
if( !function_exists("namespace_wp_get_attachment") ) :
function namespace_wp_get_attachment( $attachment_id, $size=null ) {
if( $size=='raw' || $size==null ) {
$attachment = get_post( $attachment_id );
return array(
'alt' => get_post_meta( $attachment->ID, '_wp_attachment_image_alt', true ),
'caption' => $attachment->post_excerpt,
'description' => $attachment->post_content,
'href' => get_permalink( $attachment->ID ),
'title' => $attachment->post_title,
'guid' => $attachment->guid,
'name' => $attachment->post_name,
"post_type" => $attachment->post_type
);
} else {
$image = wp_get_attachment_image_src( $attachment_id, $size );
return $image;
}
}
endif;