Advertisement
Guest User

Untitled

a guest
Jan 9th, 2013
20
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. function attachment_toolbox($size = thumbnail) {
  2.  
  3. if($images = get_children(array(
  4. 'post_parent' => get_the_ID(),
  5. 'post_type' => 'attachment',
  6. 'numberposts' => -1, // show all
  7. 'post_status' => null,
  8. 'post_mime_type' => 'image',
  9. 'orderby' => 'menu_order'
  10. ))) {
  11. foreach($images as $image) {
  12. $attimg = wp_get_attachment_image($image->ID,$size);
  13. $atturl = wp_get_attachment_url($image->ID);
  14. $attlink = get_attachment_link($image->ID);
  15. $postlink = get_permalink($image->post_parent);
  16. $atttitle = apply_filters('the_title',$image->post_title);
  17. /*
  18. echo '<p><strong>wp_get_attachment_image()</strong><br />'.$attimg.'</p>';
  19. echo '<p><strong>wp_get_attachment_url()</strong><br />'.$atturl.'</p>';
  20. echo '<p><strong>get_attachment_link()</strong><br />'.$attlink.'</p>';
  21. echo '<p><strong>get_permalink()</strong><br />'.$postlink.'</p>';
  22. echo '<p><strong>Title of attachment</strong><br />'.$atttitle.'</p>';
  23. echo '<p><strong>Image link to attachment page</strong><br /><a href="'.$attlink.'">'.$attimg.'</a></p>';
  24. echo '<p><strong>Image link to attachment post</strong><br /><a href="'.$postlink.'">'.$attimg.'</a></p>';
  25. echo '<p><strong>Image link to attachment file</strong><br /><a href="'.$atturl.'">'.$attimg.'</a></p>';
  26. */
  27. echo'<li class="wrapperli"><a title="'.$atttitle.'" href="'.$atturl.'">'.$attimg.'</a></li>';
  28. }
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement