Posted By

davebowker on 09/19/11


Tagged


Versions (?)

Get ALL attachments from wordpress


 / Published in: PHP
 

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

Report this snippet  

You need to login to post a comment.