Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. <?php
  2. $excluded = array(1,35,37);
  3. $args = array(
  4. 'post_type' => 'attachment',
  5. 'numberposts' => '5',
  6. 'category__not_in' => $excluded
  7. );
  8. $images = get_posts($args);
  9. if (!empty($images)) {
  10. ?>
  11. <div class="wrap">
  12. <h5><span>Recently</span> Added</h5>
  13. <ul>
  14. <?php
  15. foreach ($images as $image) {
  16. $attachment_link = get_attachment_link( $image->ID );
  17. echo "<li><a href='".$attachment_link."'>".wp_get_attachment_image($image->ID)."</a></li>";
  18. }
  19. ?>
  20. </ul>
  21. </div>
  22. <?php } ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement