Hello guys I have already try plugins for this , but doesnt work as I want .I just want a widget that show popular post by facebook likes .
This is very close to what I want .http://andrewnorcross.com/plugins/fb-likes-list/ .
is very small widget plugin , but I dont know how to add a facebook likes on each post link .
This is what I want : http://easycaptures.com/fs/uploaded/566/7600354318.png
Navjot Singh answers:
You will have to modify the plugin file for that. Open fb-likes-list.php file and find this code:
echo '</a>';
After this add
echo '<div class="fb-like" data-href="'.$link.'" data-send="false" data-layout="button_count" data-width="450" data-show-faces="false"></div>'
Also make sure this javascript code is somewhere in your theme's header.php or footer.php
<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>
Navjot Singh comments:
@Dbranes I have fixed that. Thank you.
Dbranes answers:
Hi, I haven't used this plugin, but you could try the html5 Like button structure:
<div class="fb-like" data-href="http://example.com" data-send="false" data-layout="button_count" data-width="450" data-show-faces="false"></div>
if you use:
<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&appId=xxxxxxxxxx";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
So instead of the plugin code
echo '<li>';
echo '<a href="'.$link.'">';
echo ''.$title.'';
if ( $show_total )
echo ' ('.$total.')';
echo '</a>';
echo '</li>';
you could try
echo '<li>';
echo '<a href="'.$link.'">';
echo ''.$title.'';
if ( $show_total )
echo ' ('.$total.')';
echo '</a>';
echo '<div class="fb-like" data-href="'.$link.'" data-send="false" data-layout="button_count" data-width="450" data-show-faces="false"></div>';
echo '</li>';
Dbranes comments:
@Navjot Singh, you beat me to it, I just saw your answer after I posted mine ;-)
<strong>ps:</strong> It looks like you have written
data-href="'.$title.'"
instead of
data-href="'.$link.'"
cheers
Magas ramo comments:
OK now I have this result ...also instead of offical facebook code we can use addthis