WP - get all attachments independent of media type
I found different solutions of how to retrieve attachments for different media types - but with the condition to specify the media type.
The following php script gets all attachment for one entry (post/page) independend of the media type.
/* print out the attachments */
$args = array(
'post_type' => 'attachment',
'numberposts' => null,
'post_status' => null,
'post_parent' => $post->ID
);
$attachments = get_posts($args);
if ($attachments)
{
_e('the attachments to this post:', 'german_newspaper');
foreach ($attachments as $attachment)
{
echo wp_get_attachment_link( $attachment->ID );
echo apply_filters('the_title', $attachment->post_title);
}
}