欢迎您光临自学哈网,只为分享网络知识教程,供大家学习参考!

「自学哈网」WordPress文章底部添加Twitter和Facebook按钮

作者 : 自学哈 本文共811个字,预计阅读时间需要3分钟 2022-11-6 共110人阅读
也想出现在这里? 联系我们

Wordpress文章底部添加Twitter和Facebook按钮

如何在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');
本站声明:
本站所有资源来源于网络,分享目的仅供大家学习和交流!如若本站内容侵犯了原著者的合法权益,可联系邮箱976157886@qq.com进行删除。
自学哈专注于免费提供最新的分享知识、网络教程、网络技术的资源分享平台,好资源不私藏,大家一起分享!

自学哈网 » 「自学哈网」WordPress文章底部添加Twitter和Facebook按钮
也想出现在这里? 联系我们
© 2022 Theme by - 自学哈网 & WordPress Theme. All rights reserved 浙ICP备2022016594号