I am having lots of problems while coming up with a solution.
I have a website that share text or image greetings( text greeting only at this time) on facebook or twitter etc. I planed to use Addthis.
So I created a function like this
<%
Function DisplayShareDiv(surl, sT, sSummary)
%>
<div class="addthis_toolbox addthis_default_style addthis_32x32_style"
addthis:url="<%=surl%>"
addthis:title="<%=sT %>"
id="addthis_container"
addthis:Description="<%=sSummary%>">
<a class="addthis_button_facebook"></a>
<a class="addthis_button_twitter"></a>
<a class="addthis_button_google_plusone"></a>
<a class="addthis_button_email"></a>
<a class="addthis_button_compact"></a>
<a class="addthis_counter addthis_bubble_style"></a>
</div>
<script type="text/javascript">var addthis_config = { "data_track_addressbar": true };</script>
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=###################3"></script>
<!-- AddThis Button END -->
<%
end function
%>
Now problem is that title appears when click on facebook or twitter but url doesn't. I also want to add the description to it. I have og tags too but they need to be dynamic too and i am having problems with fb not picking up that info either. Even though i have run it through debugger. I am at it for 2 days and it is now all a mish mash. I would really appreciate if someone can please help me!!
Now I'm getting this. Is that as you require?
I think facebook was picking up an old version of your page.
The text it picked up were from the OG and description meta tags on your home page.
If you run your page through their debugging tool, that forces it to scrape the latest version of your page. Plus you might get some useful info too. https://developers.facebook.com/tools/debug/
Tristans.tk
This is my website.
This is the div that holds the like button:
<div class="like_holder">
<div class="fb-like" data-href="http://tristans.tk/view/<?php echo $news_item['ID'] ?>" data-send="true" data-layout="button_count" data-width="136" data-show-faces="false">
</div>
</div>
Now the problem is if I click the like button, it likes all posts.
How can I make it that it likes individual ones? They clearly have different urls!.
can you try making the og:url meta tag in you page dynamic and let us know if that fixes the problem?
thanks.
I'm using Facebook Like on my product pages. When somebody like's a product the wrong tekst and image is displayed on the Timeline of the User. Pinterest and Twitter are working okay.
I use Opencart version 1.5.2.1 and my buttons are from Addthis. The Pinterest button is modified for Opencart. The code i use is:
<div class="share"><!-- AddThis Button BEGIN --> <div
class="addthis_toolbox addthis_default_style "> <a
class="addthis_button_pinterest" pi:pinit:url=<?php echo
$breadcrumb['href']; ?> pi:pinit:media=<?php echo $thumb; ?>
pi:pinit:layout="none"></a> <a class="addthis_button_tweet"
tw:count="none"></a> <a class="addthis_button_facebook_like"
fb:like:width="85" /></a> </div> <script type="text/javascript"
src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=ra-4f68526319f4252e"></script>
<!-- AddThis Button END -->
If someone is able to help me with this it would be very appreciated.
It was a user agent problem.
Facebook was not able to see my page.
It is solved now by putting the user agent in array.
Facebook comments on my website work well except the fact when someone comments on one article that same comment shows up on every article on the website. Obviously, I don't want that. What I did is basically copy and paste code offered on developers.facebook.com:
`<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/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>`
`<div class="fb-comments" data-href="http://example.com" data-num-posts="2" data- width="470"></div>`
What did I do wrong? I would appreciate any help.
Vio
You using same data-href attribute for comments social plugin on all pages (linking comments to http://example.com)
You should either provide URL of your post or leave this attribute empty (current page URL is used by default if this attribute missing or empty) on each page comments social plugin placed.
I have same problem, tried the solution offered by "juicy scripter" and I get "The comments plugin requires an href parameter." Then I found out juicy's solution should work if you use the XFBML version of the plugin.
In any case the solution I implemented on my static php site was to replace the href/URL with this code
<?php echo('http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); ?>
Don't use the root url for the data-href. You need to generate the url for each page dynamically. E.g. if this was a WordPress blog, you would use php code data-href="<?php echo(get_permalink()) ?>"
This would work fine, but I found that in one site I could not use PHP. So This worked for me as a javscript solution. Simple replace the comments div with this javascript code...
<script>document.write("<div class='fb-comments' data-href='" + window.location.href + "' data-num-posts='2' data-width='470'></div>");</script>
Try This:
< div class="fb-comments" expr.href='data:post.url' data-width="600" data-numposts="5" data-colorscheme="light">
NOte:
in the above line in between < and div there is no space.
paste this code just above to
class='post-footer-line post-footer-line-3
Check in: http://debaonline4u.blogspot.com
I put the page url after the domain and it's work for me.
MyDomain is the domain I out when I create the code on the Facebook comments.
<div class="fb-comments" data-href="http://MyDomain/Mypage URL" data-numposts="5" data-colorscheme="light"></div>
The problem is data-href.
Use dynamic URL instead.
For eg. If you want Facebook comment for every page separately.
PHP :
data-href="<?php echo 'http://'. $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; ?>"
Hope it help someone.
Due to the need to have separation of concerns...."data-href" tag is there to serve...
For example: if you have some page www.example/123.com,,,, your data-href value must be www.example/123.com....
For doing this means is that render and store comments for
www.example/123.com and it will not then appear on other pages....
Use this for for PHP Laravel.
$currentURL = URL::current();//get currnt url
<div class="comment-form-area">
<div class="sharethis-inline-reaction-buttons"></div>
<div class="fb-comments" data-href="{{$currentURL}}" data-width="700" data-numposts="5">
</div>
</div>
if you use in Laravel Blade Templates do this.
#php $currentURL = URL::current(); #endphp
<div class="comment-form-area">
<div class="sharethis-inline-reaction-buttons"></div>
<div class="fb-comments" data-href="{{$currentURL}}" data-width="700" data-numposts="5">
</div>
</div>
I have one site - example.com and ones mirror - example2.com. Both sites are completely similar and are established on one Jomla's base.
I have like bottom with ID to example.com and on the example2.com this bottom doesn't work (because of wrong ID).
Is it possible to solve this problem - to have two site names and wotking facebook like bottom?
Get rid of the ID and look into documenation on how to generate Like button. Here is Facebook Like Button API documentation/generator.
Like button takes URL as parameter. So simply do this:
Include the JavaScript SDK on your page once, ideally right after the opening tag. http://developers.facebook.com/docs/reference/javascript/
Place the code for your plugin wherever you want the plugin to appear on your page.
On Site #1:
<div class="fb-like" data-href="http://example1.com" data-send="true"
data-width="450" data-show-faces="true"></div>
On Site #2:
<div class="fb-like" data-href="http://example2.com" data-send="true"
data-width="450" data-show-faces="true"></div>
Or more dynamic:
<div class="fb-like" data-href="http://<?php echo $_SERVER['SERVER_NAME']; ?>" data-send="true" data-width="450" data-show-faces="true"></div>
Or Joomla Specific, get live_site configuration from config and display it:
$cfg -> reference to Joomla Config
<div class="fb-like" data-href="<?php echo $cfg->live_site; ?>" data-send="true" data-width="450" data-show-faces="true"></div>