/ Published in: PHP

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
'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>'; } }
Comments
