Home Forums Plugin Support WP User Frontend Pro first image only

This topic is: resolved

This topic contains 1 reply, has 2 voices, and was last updated by  Sekander Badsha 4 years, 8 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #26538

    Olivier
    Member
    Post count: 6

    Hi,
    I got an image loader, that I display like you indicated in my php :
    $images = get_post_meta( $post->ID, ‘photos_flat' );

    if ( $images){

    foreach ( $images as $attachment_id ) {

    $thumb = wp_get_attachment_image( $attachment_id, ‘thumbnail' );
    $full_size = wp_get_attachment_url( $attachment_id );

    printf( ‘

    ‘, $full_size, $thumb );
    }

    }

    I want to display only the first image from the post, is there an easy way ?
    I'm a bit lost with it …

    Thanks,

    #26635

    Sekander Badsha
    Member
    Post count: 2067

    Hello Olivier,
    We do not provide any customization support. This article can be helpful for you: http://css-tricks.com/snippets/wordpress/get-the-first-image-from-a-post/

    You may google for “get first image wordpress” to get more solutions.

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘first image only’ is closed to new replies.