Facebook Share Meta Tags - facebook

I have my meta tags working until I changed it to be appeared only when a certain page is loaded.
This is my code:
<title>
Effro | <?php echo isset($metatitle) ? $metatitle : 'Homepage'; ?>
</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!--Facebook og -->
<meta property="fb:app_id" content="1247181518629773" />
<?php
if(isset($is_ref) && $is_ref):
?>
<meta property="og:type" content="website" />
<meta property="og:title" content="Effro - We Solve Your Ambitious Event" />
<meta property="og:description" content="This i s a test Description" />
<meta property="og:image" content="<?php echo base_url().'assets/img/Effro_Facebook_Share.jpg'; ?>" />
<meta property="og:url" content="<?php echo site_url().'talents/referral'; ?>" />
<?php
endif;
?>
I tried Open Graph Object Debugger several times. But it is not picking up the values.

Related

How can I specify the image facebook will show when using a redirect?

We are building a mobile app and are sharing a user's ranking. To do so, we have a URL set up that simply returns og- tags:
<!DOCTYPE html>
<html>
<head>
<meta property="fb:app_id" content="{{ env('FACEBOOK_CLIENT_ID') }}" />
<meta property="og:url" content="{{ $url }}" />
<meta property="og:type" content="article" />
<meta property="og:title" content="{{ $title }}" />
<meta property="og:description" content="{{ $content }}" />
<meta property="og:image" content="{{ $image }}" />
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta http-equiv="refresh" content="0; url={{ $url }}" />
<title>Redirecting...</title>
</head>
<body>
</body>
</html>
The only problem is it is ignoring the meta data on this view in favor of the meta data from the redirect URL. For example, we can set a description and image here, but if the redirect URL goes to google, then it will grab google's description and image.
If we disable the og:url and <meta http-equiv="refresh" content="0; url={{ $url }}" /> tags, then it displays the proper content, but the user won't be redirected properly.
Can I force it to use the metadata from this page (such as the image, description, etc.) while still presenting the redirect URL?

how do i share an image on facebook?

I read about that I have to include this in my head tag
<meta property="og:title" content="<?php echo $photo['photo_name']; ?>" />
<meta property="og:description" content="<?php echo $photo['description']; ?>" />
<meta property="og:url" content="<?php echo $url; ?>detail.php?id=<?php echo $id; ?>" />
<meta property="og:image" content="<?php echo $canvas_url. 'libs/upload/upload/' .$photo['user_id'] .'/miniatury/' .$photo['name']; ?>" />
<meta property="og:image:secure_url" content="<?php echo $canvas_url. 'libs/upload/upload/' .$photo['user_id'] .'/miniatury/' .$photo['name']; ?>" />
<meta property="fb:app_id" content="<?php echo $appId; ?>
the php script is correct , but still i don't get anything when i share an image. I got this :
how can i manage that ? thx
You want to publish a feed, where you want to show an image too right?
Define og:picture tag. Eg:
<meta property="og:picture" ....>

FB Share this link doesn't fetch post desc and thumb

On a wordpress site, I'm using sharethis plugin...
http://support.sharethis.com/customer/portal/articles/446440-wordpress-integration
Where FB Share Link Button doesn't fetch and display Post description & image on facebook.
Any idea/hint what could be wrong?
Please add this function into your functions.php file.
function wpc_fb_opengraph() {
$wpc_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), 'large');
?>
<meta property="og:title" content="<?php the_title(); ?>" />
<meta property="og:url" content="<?php the_permalink(); ?>" />
<meta property="og:site_name" content="<?php bloginfo('name'); ?>" />
<meta property="og:description" content="<?php echo strip_tags(get_the_excerpt($post->ID)); ?>" />
<meta property="fb:app_id" content="APP ID HERE">
<meta property="fb:admins" content="YOUR FB USER ID (OR USERNAME) HERE"/>
<meta property="og:image" content="<?php echo $wpc_image_url[0] ?>"/>
<?php }
add_action('wp_head', 'wpc_fb_opengraph');
Note : if you haven't yet any facebook app for your web pages you dont have to use this lines .
<meta property="fb:app_id" content="APP ID HERE">
<meta property="fb:admins" content="YOUR FB USER ID (OR USERNAME) HERE"/>
Happy Wordpress..
You might want to try implemented the Open Graph Meta Tags if you haven't - the will give Facebook's servers hints as to what content you want to display if it can't be parsed automatically.
Info here: http://davidwalsh.name/facebook-meta-tags

Wordpress thumbnail and meta data being ignored when posting to facebook wall

I'm having a problem that I can't seem to figure out, though I'm not sure if I'm on the right track. Can anyone please advise?
I've just created a wordpress website, that post's will be shared on facebook.
I'm using featured images and I would like my featured image facebook thumbnail to be used.
It seems when I post a link to facebook, facebook just picks up images on the page and you can choose a thumbnail.
I'm not really up for that because the images are landscape and don't look good. So I started looking into meta tag with the open graph property to see if I could dynamically populate the content that facebook captures when posting a link to the wall.
This is what I tried...
<meta name="description" content="" />
<meta name="author" content="" />
<meta charset="utf-8" />
<meta property="fb:app_id" content="0000000000000000" />
<?php if ( is_single() || is_page() ) { ?>
<meta property="og:title" content="<?php echo get_the_title(); ?>" />
<meta property="og:type" content="article" />
<meta property="og:url" content="<?php echo get_permalink(); ?>" />
<meta property="og:image" content="<?php $fbthumb = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'facebook-thumb' ); echo $fbthumb[0]; ?>" />
<meta property="og:site_name" content="myblog.co.uk"/>
<meta property="og:description" content="<?php echo get_the_excerpt(); ?>" />
<?php } ?>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
But all of this is ignored!!!
Can anyone help me understand how to control the content facebook draws in via a link being posted to a wall. I would appreciated your help very much.
Thanks
I had this problem the other day. Facebook wants og:images to be larger than 200px in both directions, or it will ignore them. I found I got the best result when I used wp_get_attachment_image_src($img.ID, 'large')
Have you tried looking at your site with the Facebook Debugger to see what it has to say about your site? https://developers.facebook.com/tools/debug

Facebook Object Debugger

We run a blog in the UK and have recently noticed that Facebook stopped pulling our post descriptions and images when an article is liked, shared etc.
Running the Facebook Object Debugger I get the following messages:
Response Code: 200
Errors That Must Be Fixed
Can't Download: Could not retrieve data from URL.
(In case you wish to see it for yourself, here is a link: https://developers.facebook.com/tools/debug/og/object?q=http%3A%2F%2Fwww.heruni.com%2F)
Below is a copy of our code -- what are we doing wrong?
<?php
function is_facebook(){
if(!(stristr($_SERVER["HTTP_USER_AGENT"],'facebook') === FALSE)) {
return true;
}
}
?>
<!DOCTYPE html>
<html dir="ltr" lang="en-US"<?php if(is_facebook()){echo ' xmlns:fb="http://www.facebook.com/2008/fbml" xmlns:og="http://opengraphprotocol.org/schema/"';}?>>
<head>
<title><?php wp_title(''); ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="msvalidate.01" content="374D59D3C3F26F6EFC410429D512A98C" />
<?php if(is_facebook()){ ?>
<meta property="og:title" content="<?php single_post_title(''); ?>"/>
<meta property="og:type" content="article"/>
<meta property="og:image" content="<?php echo wp_get_attachment_thumb_url( get_post_thumbnail_id( $post->ID ) ) ?>"/>
<meta property="og:url" content="http://<?php echo $_SERVER["HTTP_HOST"].$_SERVER["REQUEST_URI"];?>"/>
<meta property="og:site_name" content="<?php bloginfo('name'); ?>"/>
<meta property="fb:app_id" content="256997234347344"/>
<?php }?>
Check if you use gzip in your page, disable it and try again. That fixed it for me.
This is the markup which Facebook sees for your page:
https://developers.facebook.com/tools/debug/og/echo?q=http%3A%2F%2Fwww.heruni.com%2F
You don't need to do any is_facebook() conditional stuff here - the tags, and the namespace should just be made visible on the web to all HTTP clients, not just the Facebook scraper.
Remove all these conditionals, and you code should work.