WordPress.org

Ready to get started?Download WordPress

Forums

New Thumbnail function and Facebook (2 posts)

  1. Justin Cline
    Member
    Posted 4 years ago #

    Any ninjas out there know if it's possible to get just the src from one of the new get_the_post_thumbnail functions? I want to take that and dump it into the header, so when a post is shared on Facebook, it specifies the post's thumbnail.

    Thanks!

  2. Mark / t31os
    Moderator
    Posted 4 years ago #

    Yeah sure it's possible...

    Although i'd personally suggest using get_post_thumbnail_id to get the ID for the thumbnail, then use wp_get_attachment_url to get the URL..

    Something like..

    $myvar = wp_get_attachment_url( get_post_thumbnail_id() );

    http://codex.wordpress.org/Function_Reference/wp_get_attachment_url

    get_post_thumbnail_id doesn't seem to have a codex page, so hence the lack of linkage for that one.. i was simply looking here ..
    http://core.trac.wordpress.org/browser/trunk/wp-includes/post-thumbnail-template.php

Topic Closed

This topic has been closed to new replies.

About this Topic