wordpress has really great functions when it comes to image attachments - but I can not find any documentation on how to get attachments that are not images .
for now, I wrote this function :
my question is : is this the only way to get attachments that are not images ?
Is there any way to do that without another query ??
for now, I wrote this function :
Code:
function ok99_get_post_file_attachment($mime='application/pdf',$limit=-1) {
global $post;
$attachments = get_children( array('post_parent' => $post->ID, 'post_status' => 'inherit', 'post_type' => 'attachment','post_mime_type' => $mime, 'order' => 'ASC', 'orderby' => 'menu_order ID', 'posts_per_page'=>$limit) );
if ($attachments) {
echo 'Your Attachments : <br/>';
foreach ($attachments as $att) {
//$attachment = array_shift($attachments); // debug to delete
echo wp_get_attachment_url($att->ID) . '<br/>';
the_attachment_link($attachment->ID, false);}
}
return false;
}
my question is : is this the only way to get attachments that are not images ?
Is there any way to do that without another query ??