Image From WordPress Won't Appear On Facebook Wall
I have recently made a custom template for my Wordpress powered site but when ever I copy a link from one of the post pages onto the Facebook wall it no longer posts the feature image with it. I used to use the Simplo template and it worked fine.
My site is http://brokeandstarving.com - If for example you copy and p开发者_StackOverflowaste that link into your Facebook status it will find a couple of thumbnails to post with it, however if you post a link to one of the posts it will not find any thumbnails! (eg. http://brokeandstarving.com/480/lemon-honey-chicken/).
On my old Simplo template it used to automatically post the Feature Image with it.
It must have something to do with the way I have structured my layout but I can't figure it out.
Any ideas?
There is a WordPress plugin called "Add image_src Meta Tag" that will do this automatically for you, using your selected post thumbnail image.
I have solved it myself once again. It turns out you need to add <link rel="image_src" href="SOURCE OF FEAUTRE IMAGE" />
in the header.php file in your WordPress template. You must also make sure that it is added below the wp_head()
function.
The specific code that worked for me was:
<link rel="image_src" href="<?php
$thumbnail_id = get_the_post_thumbnail( $post->ID );
preg_match( '/src="(.*)" class/', $thumbnail_id, $link );
echo $link[1];
?>
精彩评论