facing an issue when i post my website link on facebook - facebook

hope you all are well, i need your help as i am facing an issue on my wordpress website when i post my website url on my facebook page it show an random image which i don't want
In this image you easily understand which issue i am talking about, i want logo of website to be shown in place of space image, Please anyone helpme out of it , Thank you in advance

You need to put open graph tags in your header.php. I usually use this combination:
<?php
$theme = wp_get_theme();
$screenshot_url = esc_url( $theme->get_screenshot() );
if ( is_home() ): ?>
<meta property="og:url" content="<?php echo get_home_url(''); ?>" />
<meta property="og:type" content="website" />
<meta property="og:title" content="<?php echo get_bloginfo('name'); ?>" />
<meta property="og:description" content="<?php echo get_bloginfo('description'); ?>" />
<meta property="og:image" content="<?php echo $screenshot_url; ?>" />
<?php elseif( is_category() ):
$cat_id = get_query_var('cat');
$cat_name = get_cat_name($cat_id);
$cat_desc = (category_description( $cat_id ) != '') ? category_description( $cat_id ) : get_bloginfo('description');
?>
<meta property="og:url" content="<?php echo get_category_link($cat_id); ?>" />
<meta property="og:type" content="website" />
<meta property="og:title" content="<?php echo $cat_name; ?>" />
<meta property="og:description" content="<?php echo $cat_desc; ?>" />
<meta property="og:image" content="<?php echo $screenshot_url; ?>" />
<?php else: ?>
<meta property="og:url" content="<?php the_permalink(); ?>" />
<meta property="og:type" content="website" />
<meta property="og:title" content="<?php echo get_the_title(); ?>" />
<meta property="og:description" content="<?php echo get_the_excerpt(); ?>" />
<?php if(has_post_thumbnail()):
$url = wp_get_attachment_url( get_post_thumbnail_id() );
?>
<meta property="og:image" content="<?php echo $url; ?>" />
<?php else: ?>
<meta property="og:image" content="<?php echo $screenshot_url; ?>" />
<?php endif; ?>
<?php endif; ?>
I put separate OG tags for home, category and other pages, with a fallback to theme image (this prevents random image being selected).
Hope this helps.

You can use this Plugin to fix your issues https://wordpress.org/plugins/facebook-thumb-fixer/ or you can follow this http://www.wpbeginner.com/wp-tutorials/how-to-fix-facebook-incorrect-thumbnail-issue-in-wordpress/
If you not get any solutions, let me know. Thanks

Try putting OpenGraph image tag like so
<meta property="og:image" content="link to your logo" />

Try this:
<meta property="og:image" content="<?php the_post_thumbnail(); ?>" />
<meta property="og:title" content="<?php the_title(); ?>" />
<meta property="og:description" content="<?php the_content(); ?>" />
<meta property="og:site_name" content="<?php bloginfo('name'); ?>" />
<meta property="og:type" content="article" />
<meta property="og:locale" content="en_US" />
<meta property="og:url" content="<?php the_permalink(); ?>" />
<meta property="og:title" content="<?php the_title(); ?>" />
<meta property="article:published_time" content="<?php echo get_the_time(); ?>" />
<meta property="article:modified_time" content="<?php the_modified_date(); ?>" />
<meta property="article:author" content="<?php the_author(); ?>" />
<meta property="article:section" content="Featured" />
<meta property="article:tag" content="<?php the_tags(); ?>" />
http://happybloggerplaza.com/how-to-fix-thumbnail-image-facebook/
https://wordpress.org/plugins/facebook-thumb-fixer/other_notes/

Related

Facebook comments moderation not working on my site

I have a my website which is www.packages.almams.com and i have implemented facebook comments with moderation. But comments are not showing at facebook moderation tool so that i can see all my comments.
<meta property="og:locale" content="en_US" />
<meta property="og:type" content="article" />
<meta property="og:title" content="title" />
<meta property="og:url" content="www.packages.almams.com" />
<meta property="og:image" content="www.packages.almams.com" />
<meta property="og:description" content="desc" />
<meta property="fb:app_id" content="126739688050411" />
<meta property="fb:admins" content="100000106016242" />
<meta property="fb:pages" content="158044824683299" />
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.10&appId=126739688050411";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
<div class="fb-comments" data-href="www.packages.almams.com" data-width="600" data-numposts="5" data-mobile="true"></div>
kindly advice me what to do?
You must choose either fb:app_id or fb:admins but not both (source: https://developers.facebook.com/docs/plugins/comments/)

Facebook OG crawler showing error

I am developing OG module in my app. Below is URL which is working fine with twitter and whasapp however showing issue with facebook.
http://nvie.in/portal/gyany/product/145
This is what facebook crawler see in my page-
<!DOCTYPE html>
<html lang="en" prefix="og: http://ogp.me/ns#">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta property="og:locale" content="en_US">
<meta property="og:type" content="website">
<link rel="canonical" href="http://nvie.in/crawler-products-page.jsp">
</head>
<body>
</body>
</html>
This is my code
<%#page pageEncoding="UTF-8"%>
<%# taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%# taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
<%# taglib uri = "http://java.sun.com/jsp/jstl/functions" prefix = "fn" %>
<%# page import="org.jsoup.*" %>
<!doctype html>
<html lang="en" prefix="og: http://ogp.me/ns#">
<%
String appVersion= "1";
String portalId= request.getAttribute("portalId").toString();
String requestProtocol=request.getScheme();
String requestDomain=request.getServerName();
String requestPort=Integer.toString(request.getServerPort());
String requestBasePath = requestProtocol+"://"+requestDomain+":"+requestPort;
%>
<head>
<meta property="og:locale" content="en_US">
<meta property="og:type" content="website" />
<link rel="canonical" href="<%=(request.getRequestURL().toString())%>">
<sql:query dataSource="jdbc/localMysql" var="result">
--- Query to fetch portal details---= '<%=portalId %>';
</sql:query>
<c:forEach var="row" items="${result.rows}">
<meta property="og:url" content="<%=(request.getRequestURL().toString())%>" />
<meta name= "twitter:card" content="summary" />
<meta name= "twitter:site" content="#####" />
<meta property="og:title" content='<c:out value=" ${row.portal_name} "/>' />
<meta property="og:description" content='<c:out value=" ${Jsoup.parse(row.portal_tagline).text()} "/>' />
<c:if test="${not empty row.file_url}">
<meta property="og:image" content='<%=requestBasePath%>/####/<c:out value="${fn:trim(row.file_url)}"/>' />
<meta name= "twitter:card" content="summary_large_image" />
</c:if>
</c:forEach>
</head>
<body>
</body>
</html>

Error: "The property offers is not recognized by Google for an object of type Offer" in Structured data

I have added below html code to a product page on one of our websites:
<div itemtype="http://schema.org/Offer" itemscope="" itemprop="offers">
<div class="product-type-data">
<div itemtype="http://schema.org/Offer" itemscope="" itemprop="offers" class="price-box">
<span id="product-price-118" class="regular-price">
<span itemprop="price" class="price">30,00 €</span>
</span>
</div>
<p class="availability in-stock">Verfügbarkeit: <span>Auf Lager</span></p>
<meta content="http://schema.org/InStock" itemprop="availability">
<div class="clearfix"></div>
</div>
<meta content="EUR" itemprop="priceCurrency">
<meta content="30" itemprop="price">
I'm receiving the Error: "The property offers is not recognized by Google for an object of type Offer" (Only for div having class "price-box" ) in Structured data when testing this in Webmaster Tools.
I am also attaching a error snapshot of webmaster here.
Is anyone able to point me in the right direction of where I'm going wrong?
Thanks
I know this is an old question, but I wanted to respond in case someone else needs an answer. I am also going to make an assumption that the offer is for a product (this isn't required, but is probably very common for most people).
To begin, I want to refer to a few resources for reading about the subject.
https://schema.org/
Google Structured Data Test Tool
Google Product Reference
I also want to clarify that the question pertains to Microdata, not JSON-LD, so I will respond with Microdata formatting.
I believe your problem is that you have an "offers" within an "offers". Try this code:
<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<div class="product-type-data">
<div class="price-box">
<span id="product-price-118" class="regular-price">
<span class="price">30,00 €</span>
</span>
</div>
<p class="availability in-stock">Verfügbarkeit: <span>Auf Lager</span></p>
<div class="clearfix"></div>
</div>
<meta content="http://schema.org/InStock" itemprop="availability">
<meta content="30" itemprop="price">
<meta content="EUR" itemprop="priceCurrency">
</div>
If you put the above code into the google testing tool, it will validate.
If you would like another example, go to the google product reference link above and in the examples section (Single product page), select the Microdata tab and then select "See Markup". This will give you a more complete example. I have included it below in case google ever removes this code.
<div itemtype="http://schema.org/Product" itemscope>
<meta itemprop="mpn" content="925872" />
<meta itemprop="name" content="Executive Anvil" />
<link itemprop="image" href="https://example.com/photos/16x9/photo.jpg" />
<link itemprop="image" href="https://example.com/photos/4x3/photo.jpg" />
<link itemprop="image" href="https://example.com/photos/1x1/photo.jpg" />
<meta itemprop="description" content="Sleeker than ACME's Classic Anvil, the Executive Anvil is perfect for the business traveler looking for something to drop from a height." />
<div itemprop="offers" itemtype="http://schema.org/Offer" itemscope>
<link itemprop="url" href="https://example.com/anvil" />
<meta itemprop="availability" content="https://schema.org/InStock" />
<meta itemprop="priceCurrency" content="USD" />
<meta itemprop="itemCondition" content="https://schema.org/UsedCondition" />
<meta itemprop="price" content="119.99" />
<meta itemprop="priceValidUntil" content="2020-11-05" />
<div itemprop="seller" itemtype="http://schema.org/Organization" itemscope>
<meta itemprop="name" content="Executive Objects" />
</div>
</div>
<div itemprop="aggregateRating" itemtype="http://schema.org/AggregateRating" itemscope>
<meta itemprop="reviewCount" content="89" />
<meta itemprop="ratingValue" content="4.4" />
</div>
<div itemprop="review" itemtype="http://schema.org/Review" itemscope>
<div itemprop="author" itemtype="http://schema.org/Person" itemscope>
<meta itemprop="name" content="Fred Benson" />
</div>
<div itemprop="reviewRating" itemtype="http://schema.org/Rating" itemscope>
<meta itemprop="ratingValue" content="4" />
<meta itemprop="bestRating" content="5" />
</div>
</div>
<meta itemprop="sku" content="0446310786" />
<div itemprop="brand" itemtype="http://schema.org/Thing" itemscope>
<meta itemprop="name" content="ACME" />
</div>
</div>
You can find examples of JSON+LD for Product type at https://schema.org/Product and for Offers https://schema.org/Offer but here's an example of:
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#type": "Product",
"aggregateRating": {
"#type": "AggregateRating",
"bestRating": "100",
"ratingCount": "24",
"ratingValue": "87"
},
"image": "dell-30in-lcd.jpg",
"name": "Dell UltraSharp 30\" LCD Monitor",
"offers": {
"#type": "AggregateOffer",
"highPrice": "$1495",
"lowPrice": "$1250",
"offerCount": "8",
"offers": [
{
"#type": "Offer",
"url": "save-a-lot-monitors.com/dell-30.html"
},
{
"#type": "Offer",
"url": "jondoe-gadgets.com/dell-30.html"
}
]
}
}
</script>

Likes won't added

I put a like button on my own website and when I click, my website is added to facebook as news feeds displaying that I likes a website, but it is no added to my profile Likes: Here the code:
<html xmlns="http://www.w3.org/1999/xhtml" lang="es" xml:lang="es" xmlns:og="http://ogp.me/ns#"
xmlns:fb="http://www.facebook.com/2008/fbml">
meta properties:
<head>
<meta property="og:title" content="Puerto Deseado Turismo" />
<meta property="og:description" content="Puerto Deseado Turismo: Agencia de viajes y turismo nacional e internacional. Contamos con transportacion propia con unidades 2012" />
<meta property="og:url" content="http://www.puertodeseadoevyt.com.ar/index.html" />
<meta property="og:type" content="website" />
<meta property="og:image" content="http://www.puertodeseadoevyt.com.ar/images/logo-pd-facebook.jpg" />
<meta property="og:image:width" content="200" />
<meta property="og:site_name" content="Puerto Deseado Turismo" />
</head>
and the iframe:
<iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.puertodeseadoevyt.com.ar&send=false&layout=button_count&width=100&show_faces=false&action=like&colorscheme=light&font&height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px; height:21px;" allowTransparency="true"></iframe>
What is missing?

Why this tab doesn't work?

I have added this tab in my page but I can't send invite to my friends. It doesn't work !! Why ?
I have used this code:
<?php $url_inc="<fb:req-choice url='http://facebook.com/Anti.Social.Development' label='Partecipa' />"; ?>
<center>
<fb:fbml>
<fb:request-form
action="index.php"
method="POST"
invite="true"
type="InvitoSpeciale"
content="Ti invito <?php echo htmlentities($url_inc); ?> " >
<fb:multi-friend-selector cols="3" rows="3" showborder="false" actiontext="Invita i tuoi amici.">
<fb:request-form-submit />
</fb:request-form>
</fb:fbml>
</center>
<fb:share-button class="meta">
<meta name="medium" content="mult"/>
<meta name="title" content="name of fan page"/>
<meta name="description" content="description of fan page"/>
<link rel="image_src" href="url to image location" />
<link rel="target_url" href="http://facebook.com/Anti.Social.Development"/>
</fb:share-button>
Hello Senior as for as I have understood you are closing extra one ">" bracket after your content heading.
For me the below code works
<fb:serverFbml width="760px">
<script type="text/fbml">
<fb:fbml>
<fb:request-form
action='http://apps.facebook.com/yoursite/'
method='POST'
type='photo fun'
content="Let's fun with facebook
<fb:req-choice url='http://www.yoursite.com' label='Register'/>"
<fb:multi-friend-selector actiontext="Select your friends."></fb:multi-friend-selector>
</fb:request-form>
</fb:fbml>
</script>
</fb:serverFbml>