Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 6th, 2012  |  syntax: None  |  size: 0.40 KB  |  hits: 60  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Wordpress get_posts (show all attachments) pagination outside of the loop
  2. <?php
  3. $args = array( 'post_type' => 'attachment', 'numberposts' => -1, 'post_status' => null, 'post_parent' => null );
  4. $attachments = get_posts( $args );
  5. if ($attachments) {
  6.     foreach ( $attachments as $post ) {
  7.         setup_postdata($post);
  8.         the_attachment_link($post->ID, true);
  9.         the_excerpt();
  10.     }
  11. }
  12. ?>