get_children() retrieves attachments, revisions, or sub-pages, p ossibly by post parent. It works similar to
<?php $args = array( 'post_parent' => 0, 'post_type' => 'any', 'numberposts' => -1, 'post_status' => 'any' ); $children = get_children( $args ); ?>
$images = get_children( 'post_type=attachment&post_mime_type=image' );
$videos = get_children( 'post_type=attachment&post_mime_type=video/mp4' );
if ( empty($images) ) {
} else { foreach ( $images as $attachment_id => $attachment )
{ echo wp_get_attachment_image( $attachment_id, 'full' ); } }
foreach ( (array) $videos as $attachment_id => $attachment )
{ echo wp_get_attachment_link( $attachment_id ); }