Posted By

gd6d on 12/13/09


Tagged

post wordpress attachment


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

maxvee8
BrianCoyDesign


How to Show WordPress Post Attachments


 / Published in: PHP
 

URL: http://www.instantshift.com/2009/12/08/22-latest-exceptional-wordpress-hacks/

  1. $args = array(
  2. 'post_type' => 'attachment',
  3. 'numberposts' => null,
  4. 'post_status' => null,
  5. 'post_parent' => $post->ID
  6. );
  7. $attachments = get_posts($args);
  8. if ($attachments) {
  9. foreach ($attachments as $attachment) {
  10. echo apply_filters('the_title', $attachment->post_title);
  11. the_attachment_link($attachment->ID, false);
  12. }
  13. }

Report this snippet  

You need to login to post a comment.