I am using facebook sharing through facebook sharer , everything is working fine except the image share, by default it is taking the logo image but i want different image.
here is the code which I am using
<a onClick="window.open('http://www.facebook.com/sharer.php?s=100&p[url]=<?php echo $fb_url; ?>', 'sharer', 'toolbar=0,status=0,width=548,height=325');" href="javascript: void(0)"> <span><i class="fa fa-facebook" aria-hidden="true"></i></span> </a>
Any kind of suggestion would be highly appreciated, Thanks for reply in advance in comment box.
Related
some pages of my web application required login, when i trying to share such pages on facebook, twitter etc. then sharing preview showing login page preview??
my code snippet:
.....
.....
<li>
<a href="http://www.facebook.com/sharer.php?p[url]=<?php echo $page_url_to_share; ?>" target="_blank">
<i class="fa fa-facebook" aria-hidden="true"></i>
</a>
</li>
<li>
<a href="http://twitter.com/share?url=<?php echo $page_url_to_share; ?>" target="_blank">
<i class="fa fa-twitter" aria-hidden="true"></i>
</a>
</li>
.....
.....
If page requires web application login then how can i show proper preview of such pages? I also applied same SEO information on login page from which its get redirected. Though its not showing proper preview?
please give me idea to show proper sharing preview of login required pages (I have fb, twitter etc. sharing buttons)
i have two wordpress sites, one in root and another in a subdirectory, named fr.
For the wordpress in the root directory the facebook share is working fine, but in case of subdirectory its not working.
here is my links
https://www.acanac.com/blog/general-category/your-go-to-halloween-safety-and-party-blog/ - Working fine
https://www.acanac.com/fr/blog/general-category/votre-blogue-de-reference-sur-la-securite-et-les-fetes-a-lhalloween/ - Not working
This is the code i am using in my site.
<a onClick="window.open('http://www.facebook.com/sharer.php?s=100&p[title]=<?php the_title() ?>&p[url]=<?php the_permalink() ?>&p[images][0]=','sharer','toolbar=0,status=0,width=580,height=325');" href="javascript: void(0)" class="" title="" href=""><i class="fa fa-facebook icon"></i></a>
Can any one please help me..... Thank you in Advance.
i have an share button on my page and have too the op:image, op:width: and op:height on my meta tags.
When user's share the page, sometimes images get an crop of top left and not take the full image. In the box when user's preview what will share the image is fine, but when in the wall the image is get the crop.
I google it but not had any solid answer. Someone can help me ?
This is my code in symfony framework:
$response = $this->getResponse();
$response->addMeta("og:image", "http://www.mydomain/upload/noticias/". $this->tbnews[0]->getImagem());
$response->addMeta("og:title", $this->tbnews[0]->getTitulo());
$response->addMeta("og:description", $this->tbnews[0]->getApoio());
$response->addMeta("og:image:width", "400px");
$response->addMeta("og:image:height", "209px");
<div class="col-md-1">
<a href="http://www.facebook.com/share.php?u=http://www.mydomain/noticias/index/<?php echo $noticia[0]->getId()?>&title=<?php echo $noticia[0]->getTitulo()?>">
<img class="fb-share-button" src="/images/fb.png" with='48px' height='48px' alt="Compartilhe essa notÃcia no seu Facebook.">
</a>
</div>
the first image is on box before share, when you confirm that.
the second image is the shared on facebook feed news, is how appear to users.
So I have the following code for facebook share.
<a href="http://www.facebook.com/sharer.php?u=<?php the_permalink(); ?>" class="post_share_facebook" onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=220,width=600');return false;">
<i class="icon-facebook"></i>
</a>
Right now, when the share button is clicked, the whole snapshot of the page is shown on the share window.
On a php file where this share button is located, I have a specific div which I want to show on the Facebook share window instead of the whole snapshot of the page.
Does anyone know how I can do this?
Thanks!
Not sure if its possible that way, you can try <?php the_permalink(); ?>#your_div_id
Another alternate would be using open graph
I have these links on my site
<a rel="nofollow" href="http://www.facebook.com/share.php?u=<;url>" class="fb_share_button" onclick="return fbs_click('http://site.com/profile/4')" target="_blank" style="text-decoration:none;"></a>
<a rel="nofollow" href="http://www.facebook.com/share.php?u=<;url>" class="fb_share_button" onclick="return fbs_click('http://site.com/profile/5')" target="_blank" style="text-decoration:none;"></a>
<a rel="nofollow" href="http://www.facebook.com/share.php?u=<;url>" class="fb_share_button" onclick="return fbs_click('http://site.com/profile/8')" target="_blank" style="text-decoration:none;"></a>
<a rel="nofollow" href="http://www.facebook.com/share.php?u=<;url>" class="fb_share_button" onclick="return fbs_click('http://site.com/profile/9')" target="_blank" style="text-decoration:none;"></a>
<a rel="nofollow" href="http://www.facebook.com/share.php?u=<;url>" class="fb_share_button" onclick="return fbs_click('http://site.com/profile/10')" target="_blank" style="text-decoration:none;"></a>
with this javascript
<script>
function fbs_click(location_place) {
u=location_place;
t=document.title;
window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');
return false;
}
</script>
and i want to know if there is a way to add text or some sort to each one uniquely so that each link as a different body ..here is my code working but where and how do i add a description of some sort
You should add Open Graph tags to the pages that you wish to share - that's how the sharer picks them up, and the nice thing is that if someone decides to just share a link in their feed the same information is picked up. The Facebook URL Linter is a great tool for figuring out what Facebook sees when it's looking for Open Graph information.
Edit: Read the OP wrong...
As far as I know/have found, you can't adjust the body text of what gets displayed in the share dialog using facebook.com/sharer.php. You may have to look into the other methods of social interaction with facebook api.
If my memory is good, you can add a parameter in the facebook.com/sharer.php? url like so :
facebook.com/sharer.php?u=yourlinke&t=The text you want it to be in the textarea