SHOW:
|
|
- or go back to the newest paste.
1 | //IMAGE ATTACHMENTS TOOLBOX | |
2 | function attachment_toolbox($size = thumbnail) { | |
3 | ||
4 | if($images = get_children(array( | |
5 | 'post_parent' => get_the_ID(), | |
6 | 'post_type' => 'attachment', | |
7 | 'numberposts' => -1, // show all | |
8 | 'post_status' => null, | |
9 | 'post_mime_type' => 'image', | |
10 | 'orderby' => 'menu_order' | |
11 | ))) { | |
12 | foreach($images as $image) { | |
13 | $attimg = wp_get_attachment_image($image->ID,$size); | |
14 | $atturl = wp_get_attachment_url($image->ID); | |
15 | $attlink = get_attachment_link($image->ID); | |
16 | $postlink = get_permalink($image->post_parent); | |
17 | $atttitle = apply_filters('the_title',$image->post_title); | |
18 | /* | |
19 | echo '<p><strong>wp_get_attachment_image()</strong><br />'.$attimg.'</p>'; | |
20 | echo '<p><strong>wp_get_attachment_url()</strong><br />'.$atturl.'</p>'; | |
21 | echo '<p><strong>get_attachment_link()</strong><br />'.$attlink.'</p>'; | |
22 | echo '<p><strong>get_permalink()</strong><br />'.$postlink.'</p>'; | |
23 | echo '<p><strong>Title of attachment</strong><br />'.$atttitle.'</p>'; | |
24 | echo '<p><strong>Image link to attachment page</strong><br /><a href="'.$attlink.'">'.$attimg.'</a></p>'; | |
25 | echo '<p><strong>Image link to attachment post</strong><br /><a href="'.$postlink.'">'.$attimg.'</a></p>'; | |
26 | echo '<p><strong>Image link to attachment file</strong><br /><a href="'.$atturl.'">'.$attimg.'</a></p>'; | |
27 | */ | |
28 | echo'<li class="wrapperli"><a title="'.$atttitle.'" href="'.$atturl.'">'.$attimg.'</a></li>'; | |
29 | } | |
30 | } | |
31 | } |