Advertisement
crondeau

WordPress get_attachement

Jun 29th, 2011
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. <ul>
  2. <?php if (have_posts()) : while (have_posts()) : the_post();
  3.  
  4. $args = array(
  5. 'post_type' => 'attachment',
  6. 'numberposts' => -1,
  7. 'post_status' => null,
  8. 'post_parent' => $post->ID
  9. );
  10. $attachments = get_posts($args);
  11. if ($attachments) {
  12. foreach ($attachments as $attachment) {
  13. print "\n";
  14. echo '<li>';
  15. the_attachment_link($attachment->ID, true);
  16. echo '<p>';
  17. echo apply_filters('the_title', $attachment->post_title);
  18. echo '</p></li>';
  19. }
  20. }
  21.  
  22. endwhile; endif; ?>
  23. </ul>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement