Revision: 51244
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at September 19, 2011 11:25 by davebowker
Initial Code
$args = array(
'post_type' => 'attachment',
'numberposts' => null,
'post_status' => null,
'post_parent' => $post->ID
);
$attachments = get_posts( $args );
if ( $attachments ) {
foreach ( $attachments as $attachment ) {
$attachment_id = $post->ID ; // attachment ID
$image_attributes = wp_get_attachment_image_src( $attachment_id );
echo $image_attributes[0];
echo $image_attributes[1];
echo $image_attributes[2];
echo '<li>';
echo wp_get_attachment_image( $attachment->ID, 'full' );
//echo filesize( get_attached_file( $attachment->ID ) );
echo get_post_meta($post->ID, 'wp_attachment_image_alt', true);
//echo wp_get_attachment_metadata( $attachment->ID, $unfiltered );
//echo wp_get_attachment_link('width');
//echo wp_get_attachment_link('height');
//echo '<p>';
//echo apply_filters( 'the_title', $attachment->post_title );
//echo '</p>';
echo '</li>';
}
}
Initial URL
Initial Description
Initial Title
Wordpress get attachments (not working, but more adaptive than previous)
Initial Tags
Initial Language
PHP