我想知道是否有创建的Facebook,Twitter和谷歌+1“分享”按钮仅使用HTML的方法,而无需插入任何一点代码任何JavaScript。
例如,可以使用如下所述动态地创建这些按钮的方法; 但他们都最终动态加载Javascript和创造的幕后自己的代码:
- http://developers.facebook.com/docs/reference/plugins/like/
- http://twitter.com/about/resources/buttons
- http://www.google.com/webmasters/+1/button/
下面的链接将注册相应的喜欢,推文和+ 1S:
- http://www.facebook.com/sharer.php?u=http://example.com
- http://twitter.com/share?url=http://example.com&text=Description
- https://plusone.google.com/_/+1/confirm?hl=en&url=http://example.com
这些链接将WordPress的工作:
Facebook的
<a href="http://www.facebook.com/sharer.php?u=<?php if(is_home()){echo home_url();}else{the_permalink();} ?>" target="_blank" title="Share this page on Facebook">Like</a>
推特
<a href="http://twitter.com/share?url=<?php if(is_home()){echo home_url();}else{the_permalink();} ?>&text=<?php the_title(); ?>" target="_blank" title="Tweet this page on Twitter">Tweet</a>
谷歌+1
<a href="https://plusone.google.com/_/+1/confirm?hl=en&url=<?php if(is_home()){echo home_url();}else{the_permalink();} ?>" target="_blank" title="Plus one this page on Google">+1</a>
加上谷歌没有在上面的例子中工作。
我用这对谷歌加。
<div id="custom-google-button">
<a href="https://plus.google.com/share?&hl=en&url=YOUR_URL_to_share" target="_blank">google+</a>
</div>
在WordPress:
<a href="https://plus.google.com/share?hl=en&url=<?php if(is_home()){echo home_url();}else{the_permalink();} ?>" target="_blank" title="Plus one this page on Google">google+</a>
LinkedIn:
<div id="custom-linkedin-button">
<a href="http://www.linkedin.com/shareArticle?mini=true&url=YOUR_URL_to_share" target="_blank">Linkedin</a>
</div>
在WordPress:
<a href="http://www.linkedin.com/shareArticle?mini=true&url=<?php if(is_home()){echo home_url();}else{the_permalink();} ?>" target="_blank">Linkedin</a>
资料来源:
- https://developers.google.com/+/plugins/share/
- https://developer.linkedin.com/documents/share-linkedin
这是提供您正在寻找的答案,而无需使用任何PHP一个非常有用的文章- http://www.hanselman.com/blog/AddSocialSharingLinksToYourBlogWithoutWidgetJavaScript.aspx
推特
<a href="https://twitter.com/intent/tweet?url=YOURURLHERE&text=YOURPOSTTITLEHERE&via=YOURTWITTERNAMEHERE">Twitter</a>
FACEBOOK
<a href="https://facebook.com/sharer.php?u=YOURURLHERE">Facebook</a>
GOOGLE +
<a href="https://plus.google.com/share?url=YOURURLHERE">Google+</a>