BuddyBoss Home – Web › Support Forums › Themes › Boss. theme › Facebook not fetching post URL preview image
Tagged: facebook, preview image, URL fetch
- This topic has 7 replies, 2 contibutors, and was last updated 9 years, 7 months ago by Alyssa.
Question
April 19, 2015 at 11:38 am #39122@bharatxxx007Hello
Hope you are doing well…I noticed that when a post URL is shared on facebook the preview image is not generated can i get to know how can i resolve it ?
Answers
April 19, 2015 at 1:34 pm #39127@alyssa-buddyboss
AlyssaParticipant@bharatxxx007 I’m afraid you’ll need to contact FaceBook for support here, I’m not sure how their algorithm pulls images.
April 19, 2015 at 3:44 pm #39135@bharatxxx007I read that it’s through open graph settings can u please tell me the open graph settings for your theme i want the following info to be fetched
Post title
Description
preview image
domain nameI also tried installing some plugins such as http://ogp.me/ but none of them worked can u please help.
Thank you so much !April 20, 2015 at 8:24 am #39141@alyssa-buddyboss
AlyssaParticipant@bharatxxx007 We do not have any Open Graph data in our theme. I think this post should help you out: http://www.wpbeginner.com/wp-themes/how-to-add-facebook-open-graph-meta-data-in-wordpress-themes/
April 20, 2015 at 10:31 am #39145@bharatxxx007I Tried ur suggestion by pasting it in the functions.php..it works but the image thumbnail that is fetched is the default one (if statement is only working) but i want the image preview to be fetched of the posted content in the activity stream whose URL is shared ..the else statement is fetching the preview image i guess but since the image posted in activity is not preview image it is not being fetched …can u tell what fragment of code should i insert in the else statement to fetch the image posted
if(!has_post_thumbnail( $post->ID )) { //the post does not have featured image, use a default image
$default_image=”http://example.com/image.jpg”; //replace this with a default image on your server or an image in your media library
echo ‘<meta property=”og:image” content=”‘ . $default_image . ‘”/>’;
}
else{
$thumbnail_src = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), ‘medium’ );
echo ‘<meta property=”og:image” content=”‘ . esc_attr( $thumbnail_src[0] ) . ‘”/>’;
}April 21, 2015 at 10:51 am #39201@alyssa-buddyboss
AlyssaParticipant@bharatxxx007 This is beyond our support but try this as the thumbnail_src:
wp_get_attachment_thumb_url( get_post_thumbnail_id( $post->ID ) )
If that doesn’t work try posting in the general forum or go onto the BuddyPress forums.April 24, 2015 at 12:32 pm #39335@bharatxxx007thanx for your support (y)
April 24, 2015 at 5:03 pm #39362@alyssa-buddyboss
AlyssaParticipant@bharatxxx007 For others reference did the above code work for you or did you figure it out another way?
- The question ‘Facebook not fetching post URL preview image’ is closed to new replies.