WordPress文章底部添加Twitter和Facebook按钮 – WordPress 教程


Wordpress文章底部添加Twitter和Facebook按钮 – 阿里云-腾讯云-vps-云服务器代金券/云服务器价格表/使用教程
wordpress

如何在WordPress文章底部自动添加上Facebook和tewitter的按钮?把下面的代码粘贴到您的 functions.php 模板文件中,保存,大功告成了。虽然Twitter已被GFW,记录一下添加方法也不错。

function share_this($content){if(!is_feed() && !is_home()) {$content .= '<div class="share-this"><a href="http://twitter.com/share"class="twitter-share-button"data-count="horizontal">Tweet</a><script type="text/javascript"src="http://platform.twitter.com/widgets.js"></script><div class="facebook-share-button"><iframesrc="http://www.facebook.com/plugins/like.php?href='.urlencode(get_permalink($post->ID)).'&amp;layout=button_count&amp;show_faces=false&amp;width=200&amp;action=like&amp;colorscheme=light&amp;height=21"scrolling="no" frameborder="0" style="border:none;overflow:hidden; width:200px; height:21px;"allowTransparency="true"></iframe></div></div>';}return$content;}add_action('the_content', 'share_this');

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注