Wordpress:如何在我的网站上添加社交媒体分享按钮?

时间:2013-10-26 14:03:12

标签: facebook wordpress

我想在我的网站上添加facebook分享按钮,这应该只是将我的网站内容发布在墙上。谁想分享它,我需要分享链接+标题。

我研究了很多但没有得到任何东西。请帮助我。

我有这个代码,假设工作,但不起作用。如果这对你有帮助,那就太好了。

我需要facebook,twitter,likein,google plus

 <a href="javascript:fb_shar();" class="string fb"></a>

                        <a href="javascript:(function(){window.twttr=window.twttr||{};var D=550,A=450,C=screen.height,B=screen.width,H=Math.round((B/2)-(D/2)),G=0,F=document,E;if(C&gt;A){G=Math.round((C/2)-(A/2))}window.twttr.shareWin=window.open('http://twitter.com/share','','left='+H+',top='+G+',width='+D+',height='+A+',personalbar=0,toolbar=0,scrollbars=1,resizable=1');E=F.createElement('script');E.src='http://platform.twitter.com/bookmarklets/share.js?v=1';F.getElementsByTagName('head')[0].appendChild(E)}());" class="string tw"></a>

                        <a target="_blank" href="http://www.linkedin.com/shareArticle?summary=&title=<?=$rowB['title'];?>&mini=true&url=<?php the_permalink(); ?>&ro=false&source=" class="string in"></a>

                        <a href="javascript:pl_shar();" class="string pl"></a>    

JS

function fb_shar()
{

var sharer = "http://www.facebook.com/sharer.php?u=";
window.open(sharer + encodeURIComponent(document.URL), 'facebook-share-dialog', 'width=626,height=436');
}
function pl_shar()
{
var sharer = "https://plus.google.com/share?url=";
window.open(sharer + document.URL, 'sharer', 'width=626,height=436');
}

2 个答案:

答案 0 :(得分:1)

我建议您使用像Sharethis这样的插件,它将拥有您需要的所有选项,并有许多其他选项。

答案 1 :(得分:0)

为什么不使用Wordpress插件。就像是http://wordpress.org/plugins/sociable/

相关问题