BuddyBoss Home – Web Support Forums Themes Boss. theme Facebook not fetching post URL preview image

Viewing 8 posts - 1 through 8 (of 8 total)
  • Question

    #39122
    @bharatxxx007

    Hello

    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

    #39127

    Alyssa
    Participant
    @alyssa-buddyboss

    @bharatxxx007 I’m afraid you’ll need to contact FaceBook for support here, I’m not sure how their algorithm pulls images.

    #39135
    @bharatxxx007

    I 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 name

    I also tried installing some plugins such as http://ogp.me/ but none of them worked can u please help.
    Thank you so much !

    #39141

    Alyssa
    Participant
    @alyssa-buddyboss

    @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/

    #39145
    @bharatxxx007

    I 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] ) . ‘”/>’;
    }

    #39201

    Alyssa
    Participant
    @alyssa-buddyboss

    @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.

    #39335
    @bharatxxx007

    thanx for your support (y)

    #39362

    Alyssa
    Participant
    @alyssa-buddyboss

    @bharatxxx007 For others reference did the above code work for you or did you figure it out another way?

Viewing 8 posts - 1 through 8 (of 8 total)
  • The question ‘Facebook not fetching post URL preview image’ is closed to new replies.