i’ve already tryed this:
$att_array = array('post_type'=>'attachment','post_mime_type'=>'image','post_parent'=>$post->ID);
$attachments = get_posts( $att_array );
if($attachments) {
// my code
}
but it doesn’t do what i want. maybe a missunderstand the meaning of attached images. I need to do some piece of code only if there any images attached to post via “add media”.