WordPress.org

Ready to get started?Download WordPress

Forums

Can the_post_thumbnail also output the link to the large image version? (6 posts)

  1. supergab
    Member
    Posted 3 years ago #

    Hi,

    I would like the_post_thumbnail function to output the thumbnail that links to the large (not the original) version of that same image.

    Is there a way I can do that using functions.php ?

    For now it simply outputs the thumbnail url.

    Many thanks

  2. Jack Reichert
    Member
    Posted 3 years ago #

    Sure thing!
    Try this:

    the_post_thumbnail('large');

    Haven't tried it but 'full' might work as well.
    or if you want to specify the size, try this:

    the_post_thumbnail( array(100,100) );

  3. supergab
    Member
    Posted 3 years ago #

    OK I was not clear enough, sorry about that.

    the_post_thumbnail outputs:

    <img src="http://link.to/img-thumbnail.jpg" />

    I would like it to output:

    <a href="http://link.to/img-large.jpg"><img src="http://link.to/img-thumbnail.jpg" /></a>

    or simply:

    http://link.to/img-large.jpg

    if possible?

  4. Jack Reichert
    Member
    Posted 3 years ago #

    Ah, got it.

    So I imagine that you'd want something like this:

    get's thumbnail id
    $id = get_post_thumbnail_id();

    //This will output the link to the full image with a thumb that's no more than 48x48.
    the_attachment_link( $id, false, array(48, 48) );

    This link should help with tweaking...

    http://codex.wordpress.org/Template_Tags/the_attachment_link

  5. supergab
    Member
    Posted 3 years ago #

    Thanks ! ;-)

  6. supergab
    Member
    Posted 3 years ago #

    Thanks... I ended up opening another thread. ;-)

Topic Closed

This topic has been closed to new replies.

About this Topic