• Resolved rw1

    (@rw1)


    i have read posts about grabbing the posts thumbnail url but am not sure how to do this in the header area with something like:

    <?php if (in_category('5') ) { the_post(); rewind_posts();
    echo '<meta property="text" content="' . wp_get_attachment_thumb_url(get_the_ID()) . '" />';
    } ?>

    but this is outputting a blank space where the thumbnail url should be.

    can anyone tell me the correct code to grab the thumbnail url of the post being viewed?

    thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter rw1

    (@rw1)

    thanks for this, fantastic 🙂

    i’ve gotten close with:

    <?php if (in_category('5') ) { the_post(); rewind_posts();
    echo '<meta property="text" content="' . wp_get_attachment_thumb_url( get_post_thumbnail_id( $post->ID ) ) . '" />';
    } ?>

    which is outputting the thumbnail url great, but now i’m wondering how to specify the thumbnail size – i know those links above provide examples of this but i can’t get it to work in the context above – any help appreciated ie how do i get it to output the url of a thumbnail that is 80 x 80.

    thanks!

    Sorry i’m not following, is your thumbnail size set to 80 x 80? If that’s the case, you should already be getting back the URL of the appropriate thumbnail, no?

    Please explain the problem in more detail.

    Thread Starter rw1

    (@rw1)

    Thanks for your reply.

    I was wondering if you could define a thumbnail with any dimensions, regardless of what you had set the thumbnail dimensions to in Settings>Media.

    Edit:

    Ah, i think this has been answered here and where i am up to is just figuring out the correct syntax. Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘how to call a posts thumbnail url in the head area?’ is closed to new replies.