Reputation: 91
I am using Twitter,google+ and Facebook sharing on my website page,From which Facebook and Twitter are working fine but in Google+ it is taking default image with share link.I want it to be my own image as i did it in Facebook.I have tried:
<!-- Place this tag after the last share tag. -->
<script type="text/javascript">
(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
</script>
Upvotes: 0
Views: 2372
Reputation: 521
If you want to take your user to another tab use below code.
<a href="https://plus.google.com/share?url=<?php the_permalink(); ?>" >Share on Google+</a>
If you want a pop up window use the below code.
<a href="#" onclick="popUp=window.open('https://plus.google.com/share?url=<?php the_permalink(); ?>', 'popupwindow', 'scrollbars=yes,width=800,height=400');popUp.focus();return false">Share on Gogole+</a>
Upvotes: 0
Reputation: 76646
Use Schema.org microdata (recommended way):
<body itemscope itemtype="http://schema.org/Product">
<h1 itemprop="name">Shiny Trinket</h1>
<img itemprop="image" src="{image-url}" />
<p itemprop="description">Shiny trinkets are shiny.</p>
</body>
Use Open Graph properties:
<meta property="og:title" content="..." />
<meta property="og:image" content="..." />
<meta property="og:description" content="..." />
Title and meta "description" tags:
If the page's <head>
element contains <title>
and <meta name="description" ... />
tags, the +Snippet uses the title and the content attribute of the description meta tag for the snippet description. For the thumbnail image, the sharebox attempts to find a suitable image on the page.
<title>...</title>
<meta name="description" content="..." />
Best guess from page content (not recommended): If none of the previous data is present, Google parses the page and attempts to find the best title, description, and image.
Extracted from documentation.
Hope this helps!
Upvotes: 2