only one thumbnail

This topic contains 1 reply and 2 voices, and was last updated by Tareq Hasan 10 years, 3 months ago
Viewing 1 Posts - 1 through 1 (of 1 total)
Author Posts
December 1, 2013 at 4:44 pm 13095
Tareq Hasan hello just a php question if i want only one thumbail the first one picture how can i do that ? thanks $images = get_post_meta( $post->ID, 'photo_du_projet' ); if ( $images ) { foreach ( $images as $attachment_id ) { $thumb = wp_get_attachment_image( $attachment_id, 'thumbnail' ); $full_size = wp_get_attachment_url( $attachment_id ); printf( '%s', $full_size, $thumb ); } } ?>
December 3, 2013 at 4:06 pm 13202
Tareq Hasan Tareq Hasan

Use like this:
[php]
$images = get_post_meta( $post->ID, ‘photo_du_projet’, true );

if ( $images ) {
$thumb = wp_get_attachment_image( $images, ‘thumbnail’ );
$full_size = wp_get_attachment_url( $images );

printf( ‘%s’, $full_size, $thumb );
}
[/php]

Viewing 1 Posts - 1 through 1 (of 1 total)