Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Facebook Share Thumbnail seclection issue WordPress

  • SOLVED

Hi Guys

Check out this site

http://richardkane.org

When you click teh Facebook share button the window comes up ok but the image from the actual post is not available for selection.

Why?

Can it be fixed?

have tried a couple of plug ins but no joy

http://wordpress.org/extend/plugins/facebook-like-thumbnail/

http://wordpress.org/extend/plugins/facebook-image-fix/

Cheers
Steve

Answers (5)

2012-12-19

Dbranes answers:

Hi, you don't have any Facebook meta data (opengraph protocol) defined for this site.

You should install this plugin

[[LINK href="http://wordpress.org/extend/plugins/wp-facebook-open-graph-protocol/"]]http://wordpress.org/extend/plugins/wp-facebook-open-graph-protocol/[[/LINK]]

to setup the relevant facebook meta data.

When you have installed it, you can check the Facebook Object debugger to see how the page metadata is fetched

[[LINK href="http://developers.facebook.com/tools/debug/og/object?q=http%3A%2F%2Frichardkane.org%2F2012%2F12%2F18%2Friding-the-off-piste-in-les-arcs%2F"]]http://developers.facebook.com/tools/debug/og/object?q=http%3A%2F%2Frichardkane.org%2F2012%2F12%2F18%2Friding-the-off-piste-in-les-arcs%2F
[[/LINK]]

The debugger currently gives an error:

Object at URL 'http://richardkane.org/2012/12/18/riding-the-off-piste-in-les-arcs/' of type 'website' is invalid because the given value '' for property 'og:image:url' could not be parsed as type '


it should be fixed when you have installed the plugin.

ps: you should also remove the two plugins (facebook-like-thumbnail and facebook-image-fix), since they are not working on you site:

<!-- Start FaceBook Image Fix <http://www.capn3m0.org> -->
<link rel="image_src" href="" />
<!-- End FaceBook Image Fix Plugin -->


<!-- Facebook Like Thumbnail -->
<meta property="og:image" content="" />
<!-- End Facebook Like Thumbnail -->

2012-12-19

Arnav Joy answers:

where is facebook share button?


Steve Watson comments:

Wrong link sorry - richardkane.org


Arnav Joy comments:

when i click on facebook share button then at new window image thumbnail is there , so can you let me know is the problem

2012-12-19

phppoet answers:

Are you using wordpress WP-PrettyPhoto like plugin . if yes then deactivate it and try again .


phppoet comments:

your facebook sharing button is working perfectly and is showing your posts default featured image . if you want your desired image in facebook sharing then use featured image feature while creating new post .


phppoet comments:

Facebook has a set of open-graph meta tags that it looks at to decide which image to show.
The key one for the Facebook image is: <meta property="og:image" content="http://ia.media-imdb.com/rock.jpg"/> and it should be present inside the <head></head> tag at the top of your page.

If these tags are not present, it will look for their older method of specifying an image: <link rel="image_src" href="/myimage.jpg"/>. If neither are present, Facebook will look at the content of your page and choose images from your page that meet its share image criteria: Image must be at least 50px by 50px, have a maximum aspect ratio of 3:1, and in PNG, JPEG or GIF format.


Either you are using a theme which automatically put some meta image tags into head or you are using a plugin which is generating few other images in the post . therefore facebook share catches the first image which matches their algorithm.

2012-12-19

Kiet Luong answers:

Hi,
can you try this code within your loop:
<link rel="image_src" href="_link_to_your_right_thumbnail_" />

also please check out this [[LINK href="http://custhemes.com/article/fixing-facebook-share-wrong-thumbnail-and-description/"]]post[[/LINK]] and debug your issue.

Hope this help !

2012-12-19

Martin Pham answers:

Please try this

function _get_image_id( $index = 0 ) {
global $post;
$image_ids = array_keys(
get_children(
array(
'post_parent' => $post->ID,
'post_type' => 'attachment',
'post_mime_type' => 'image',
'orderby' => 'menu_order',
'order' => 'ASC',
)
)
);
if ( isset( $image_ids[$index] ) )
return $image_ids[$index];
return false;
}

function get_att_images($args = array()) {
global $post;
$defaults = array(
'format' => 'url',
'size' => 'full',
'num' => 0,
'attr' => '',
);
$args = wp_parse_args( $args, $defaults );
if ( has_post_thumbnail() && ( 0 === $args['num'] ) ) {
$id = get_post_thumbnail_id();
$html = wp_get_attachment_image( $id, $args['size'], false, $args['attr'] );
list( $url ) = wp_get_attachment_image_src( $id, $args['size'], false, $args['attr'] );
} else {
$id = _get_image_id( $args['num'] );
$html = wp_get_attachment_image( $id, $args['size'], false, $args['attr'] );
list( $url ) = wp_get_attachment_image_src( $id, $args['size'], false, $args['attr'] );
}
$src = str_replace( home_url(), '', $url );

if ( 'html' === strtolower( $args['format'] ) )
$output = $html;
elseif ( 'url' === strtolower( $args['format'] ) )
$output = $url;
else
$output = $src;

if ( empty( $url ) ) $output = false;
return $output;
}



function insert_fb_in_head() {
global $post;
if ( !is_singular()) //if it is not a post or a page
return;

echo '<meta property="og:url" content="' . get_permalink() . '"/>';
echo '<meta property="og:locale" content="en_US" />';
echo '<meta property="og:title" content="' . get_the_title() . '"/>';
echo '<meta property="og:type" content="article"/>';
// get img src from custom field
$post_thumb = get_post_meta($post->ID, 'image', true);
if(empty($post_thumb)) {
$post_thumb = get_att_images();
}
echo '<meta property="og:image" content="' .$post_thumb. '" />';
echo "\n";
}
add_action( 'wp_head', 'insert_fb_in_head', 5 );


Insert into functions.php or gazette/includes/theme-functions.php
[[LINK href="http://phim16.com/"]]phim[[/LINK]]