生命不息,奋斗不止/创造价值-传递价值-获得价值
所谓迷茫,就是才华配不上梦想 每一个让你难堪的现在,都有一个不够努力的曾经

在日志底部自动添加Twitter和Facebook按钮

把下面的代码粘贴到您的 functions.php 模板文件中,保存,大功告成了。虽然Twitter已被GFW,记录一下添加方法也不错。

  1. function share_this($content){
  2. if(!is_feed() && !is_home()) {
  3. $content .= ‘<div class=“share-this”>
  4. <a href=“http://twitter.com/share”
  5. class=“twitter-share-button”
  6. data-count=“horizontal”>Tweet</a>
  7. <script type=“text/javascript”
  8. src=“http://platform.twitter.com/widgets.js”></script>
  9. <div class=“facebook-share-button”>
  10. <iframe
  11. src=“http://www.facebook.com/plugins/like.php?href=’.
  12. urlencode(get_permalink($post->ID))
  13. .’&amp;layout=button_count&amp;show_faces=false&amp;width=200&amp;action=like&amp;colorscheme=light&amp;height=21″
  14. scrolling=“no” frameborder=“0” style=“border:none;
  15. overflow:hidden; width:200px; height:21px;”
  16. allowTransparency=“true”></iframe>
  17. </div>
  18. </div>’;
  19. }
  20. return $content;
  21. }
  22. add_action(‘the_content’, ‘share_this’);
赞(0)
未经允许不得转载:jack361博客 » 在日志底部自动添加Twitter和Facebook按钮

如果你爱我或恨我,请↓

联系我