Support » Plugin: Attachments » First instance

  • Resolved videogramme

    (@videogramme)


    Hi,

    how exactly do i get the first “thumbnail” attach to a post ?

    I have multiple images attache on my post.
    But i need to just take the first image in thumbnail size.
    If have got this code that display all attached images in thumbnail size :

    $attachments = new Attachments( 'my_attachments' );
    	if( $attachments->exist() ) :
        	    while( $attachments->get() ) :
           		$attachments->image( 'thumbnail' ));
                endwhile;
    	endif;

    thanks in advance.

    http://wordpress.org/extend/plugins/attachments/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Jonathan Christopher

    (@jchristopher)

    Hi, check out the usage docs to see that you need to echo your call to image():

    $attachments = new Attachments( 'my_attachments' );
    if( $attachments->exist() ) :
        while( $attachments->get() ) :
            echo $attachments->image( 'thumbnail' );
        endwhile;
    endif;

    If you enjoy Attachments please take a second to rate and review!

    Hi,

    Thanks for the fast respons.
    Sorry it was a copy error.
    But i still don’t know how to display only the first attached image.
    Help will be much appreciat.

    Thx in advance

    [Don’t bump]

    it’s not resolved pls give me some help

    Plugin Author Jonathan Christopher

    (@jchristopher)

    $attachments = new Attachments( 'my_attachments' );
    if( $attachments->exist() ) :
        $attachments->get();
        echo $attachments->image( 'thumbnail' );
    endif;

    Thank you verry much. It work like a charme. Your awesome ; )

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘First instance’ is closed to new replies.