Need to do a check if post has attachments that are not images.
I haven’t seen this anywhere – thoughts?

2 s
2

You can use the following within a loop:

$files = get_attached_media( $type, $post_id );

Just define the attachment MIME type on $type. Second parameter is optional. Example from the Codex page:

$media = get_attached_media( 'audio', 102 );

With the retrieved array, you can do something like:

if( $media ) {
   //Show the post attachments that are not images, but audio
}

Leave a Reply

Your email address will not be published. Required fields are marked *