WordPress.org

Forums

Articles linked on Facebook don't display thumbnails images (4 posts)

  1. silis25
    Member
    Posted 3 years ago #

    Hi,

    I need help with the following:

    Problem: Articles linked on Facebook don't display thumbnails images. Facebook like/share doesn't represent my posts properly. It chooses the first picture which happens to be my post title.

    2. I'm using two plugins:

    a. Tweet, Like, Share and Google +1 Option Page
    b. Simple Social - Sharing Widgets & Icons

    How should I modify the facebook plugin so it will show my second image all of the time (my first is the title)when someone press like/share button?

    At 'Tweet, Like, Share and Google +1' plugin code, there are two attributes which define the og:image:

    <meta property="og:image" content="<?php echo $thumb; ?>" />
    <meta property="og:image" content="<?php echo $default_img; ?>" />
    function s4_get_first_image() {
    global $post, $posts;
    $first_img = '';
    ob_start();
    ob_end_clean();
    $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
    $first_img = $matches[1][0];
    return $first_img;
    }

    From the code, the point where I need to define the picture number is:

    $matches[1][0]

    Should I change it to $matches[2][0]?

    Thanks and regards,

    Kfir Silis

  2. Joseph Shaw
    Member
    Posted 3 years ago #

    I've run into this before but someone else was managing the installation and I couldn't get them to figure this out.

    My suspicion is that it has nothing to do with your plugins. What happens if you copy the url of the page/post, then log into facebook and paste the url into an update directly?

    If it still won't show the thumbnails then its not the plugins.

    If so it must be something in your server, installation, theme, or security that's preventing the thumbnails from loading.

  3. silis25
    Member
    Posted 3 years ago #

    The thumbnail is loading but it takes only the first picture.
    That is the problem.
    The first picture is meaningless as it's the post title picture.
    I will play with the code once more.
    Thanks

  4. ragtopb
    Member
    Posted 3 years ago #

    I had a similar problem. I'm Not so sure about "making it be the second image", but puting the code found here http://snippi.com/s/zz27qpg in my Header.php file worked for me.

Topic Closed

This topic has been closed to new replies.

About this Topic