Wordpress Attachment Image
Copy this code and paste it in your HTML
<?php
$attachments = get_children
( array('post_parent' => get_the_ID
(), 'post_type' => 'attachment', 'post_mime_type' => 'image') );
foreach ( $attachments as $attachment_id => $attachment ) {
echo 'wp_get_attachment_image: ' . wp_get_attachment_image
( $attachment_id, array(200,250) ) . '<br />';
echo 'wp_get_attachment_link: ' . wp_get_attachment_link
( $attachment_id ) . '<br />';
echo 'wp_get_attachment_url: ' . wp_get_attachment_url
( $attachment_id ) . '<br />';
echo 'wp_get_attachment_thumb_url: ' . wp_get_attachment_thumb_url
( $attachment_id ) . '<br />';
echo 'get_attachment_link: ' . get_attachment_link
( $attachment_id ) . '<br />';
$src = image_get_intermediate_size( $attachment_id, 'medium' );
$src = wp_get_attachment_image_src( $attachment_id, 'full', true );
echo 'Title of attachment: ' . apply_filters
( 'the_title', $attachment->post_title ) . '<br />';
echo 'Link to post: ' . get_permalink
($image->post_parent) . '<br />';
echo '<hr style="clear:both;" /></p>';
} ?>
Report this snippet