$args = array(
'post_type' => 'attachment',
'numberposts' => null,
'post_status' => null,
'post_parent' => $post->ID
);
$attachments = get_posts($args);
if ($attachments) {
foreach ($attachments as $attachment) {
echo apply_filters('the_title', $attachment->post_title);
the_attachment_link($attachment->ID, false);
}
}
In the code above, theres exist a way to get:
-
All attachments links except featured image.
-
All PDF attachments links only.
I was reading:
-
http://www.wprecipes.com/how-to-show-wordpress-post-attachments
-
http://johnford.is/programmatically-pull-attachments-from-wordpress-posts/