wordpress添加媒体

Earlier on this blog, we created a Social Media Cheat Sheet for WordPress, but that only showed you how to add social media buttons. As social media grows and the web matures, we are seeing less and less of the simple social media buttons. Social media buttons are being replaced by the share count widgets such as tweetmeme retweet widget, digg counter, facebook share and more. In this article, we will show you how you can add different social media share count buttons in WordPress.

在此博客的前面,我们为WordPress创建了一个社交媒体备忘单 ,但仅向您展示了如何添加社交媒体按钮。 随着社交媒体的发展和网络的成熟,我们越来越看不到简单的社交媒体按钮。 社交媒体按钮已被共享计数小部件取代,例如tweetmeme转推小部件,digg计数器,facebook共享等。 在本文中,我们将向您展示如何在WordPress中添加不同的社交媒体共享计数按钮。

抓住原始小部件 (Grab the Original Widget)

Most of the share counts are a piece of JavaScript that you must retrieve from the social media service. This article is also meant to serve as a one stop shop. You can come here to find the location for top social media services because a lot of them makes it really hard to find on their sites. The goal of this article is to avoid using as many plugins as possible, so when you are picking the type choose site: Normal.

大多数共享计数是您必须从社交媒体服务中检索的一段JavaScript。 本文还旨在充当一站式商店。 您可以来这里找到顶级社交媒体服务的位置,因为其中很多使得在他们的网站上很难找到。 本文的目的是避免使用尽可能多的插件,因此在选择类型时,请选择站点:正常。

  • Digg掘客
  • StumbleUpon偶然发现
  • Tweetmeme RetweetTweetmeme转推
  • Facebook Share脸书分享
  • Facebook Like ButtonFacebook的喜欢按钮
  • RedditReddit
  • Njuice Google BuzzNjuice Google Buzz
  • Sphinn斯宾

自定义代码 (Customizing the Codes)

Because we chose the code for a Normal Site, we may need to modify it to make it compatible with WordPress. We are also going to be showing just the Compact Share Count Buttons. You can ofcourse use the codes as a guide to get different sizes.

因为我们选择了“普通站点”的代码,所以我们可能需要对其进行修改以使其与WordPress兼容。 我们还将仅显示紧凑型共享计数按钮。 您当然可以使用代码作为指导来获取不同的大小。

Note: You must paste all of these codes inside a loop, most likely in your single.php file.

注意:您必须将所有这些代码粘贴到循环中,最有可能粘贴在single.php文件中。

掘客 (Digg)

<script type="text/javascript">
(function() {
var s = document.createElement('SCRIPT'), s1 = document.getElementsByTagName('SCRIPT')[0];
s.type = 'text/javascript';
s.async = true;
s.src = 'http://widgets.digg.com/buttons.js';
s1.parentNode.insertBefore(s, s1);
})();
</script>
<a class="DiggThisButton DiggCompact" href="http://digg.com/submit?url=<?php the_permalink(); ?>"></a>

Normally, you should not have to add the href part of the link area. But if you don’t, and you have paginated comments or posts, then your digg button will not work on all pages. So if the main page was submitted, the second page will show a submit URL allowing users to submit duplicate content to digg.

通常,您不必添加链接区域的href部分。 但是,如果您没有这样做,并且您已对评论或帖子进行了分页,则digg按钮将无法在所有页面上使用。 因此,如果主页已提交,则第二页将显示一个提交URL,允许用户将重复的内容提交给digg。

偶然发现 (StumbleUpon)

<script src="http://www.stumbleupon.com/hostedbadge.php?s=1&r=<?php the_permalink(); ?>"></script>

Tweetmeme转推 (Tweetmeme Retweet)

<script type="text/javascript">
tweetmeme_source = 'wpbeginner'; tweetmeme_service = 'bit.ly'; tweetmeme_style = 'compact'; tweetmeme_url = '<?php the_permalink() ?>';
</script>
<script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"></script>

Make sure that you change the Tweetmeme_source variable to your twitter handle. Right now it is @wpbeginner. So whenever someone clicks it will show RT @wpbeginner Post Title – Link. We are using bit.ly as the link shortening service, you can change it to others that tweetmeme offers, but bit.ly is the best one.

确保将Tweetmeme_source变量更改为Twitter句柄。 现在是@wpbeginner。 因此,只要有人单击它,就会显示RT @wpbeginner帖子标题–链接。 我们使用bit.ly作为链接缩短服务,您可以将其更改为tweetmeme提供的其他服务,但是bit.ly是最好的一种。

脸书分享 (Facebook Share)

<a name="fb_share" type="button_count" share_url="<?php the_permalink(); ?>" href="http://www.facebook.com/sharer.php">Share</a><script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>

Facebook的喜欢按钮 (Facebook Like Button)

Facebook Like Button is a phonemonal tool for traffic. Syed has shown how it has helped in our WordPress Newsletter in the past.

Facebook Like Button是用于流量的语音工具。 Syed在过去的WordPress新闻中已展示了它的帮助。

<iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo urlencode(get_permalink($post->ID)); ?>&amp;layout=standard&amp;show_faces=false&amp;width=450&amp;action=like&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:60px;"></iframe>

To see more options see How to Add Facebook Like button in WordPress.

要查看更多选项,请参阅如何在WordPress中添加“喜欢Facebook”按钮 。

Reddit (Reddit)

<script type="text/javascript">
reddit_url = "<?php the_permalink(); ?>";
reddit_title = "<?php the_title(); ?>";
</script>
<script type="text/javascript" src="http://reddit.com/static/button/button1.js"></script>

Njuice Google Buzz计数 (Njuice Google Buzz Count)

Google Buzz do not have an active API that allows to keep track of count. There are a few ways to work around that which gives you some what of a misguided count. But for those users, who want to have a Google Buzz Count, then here is how you can add it.

Google Buzz没有有效的API,无法跟踪计数。 有几种方法可以解决该问题,这给了您一些误导。 但是对于那些想要拥有Google Buzz计数的用户,则可以按以下方法添加它。

<script type="text/javascript">
var njuice_buzz_size = 'small';
var njuice_buzz_title = '<?php the_title(); ?>';
var njuice_buzz_url = '<?php the_permalink(); ?>';
</script>
<script type="text/javascript" src="http://button.njuice.com/buzz.js"></script>

斯宾 (Sphinn)

<script type="text/javascript">submit_url = '<?php the_permalink(); ?>';</script>
<script type="text/javascript" src="http://sphinn.com/evb/buttons.php?b=small"></script>

领英按钮 (LinkedIn Button)

<script type="text/javascript" src="http://platform.linkedin.com/in.js"></script><script type="in/share" data-url="<?php the_permalink(); ?>" data-counter="top"></script>

Source: How to Add Official LinkedIn Button in WordPress

来源: 如何在WordPress中添加官方LinkedIn按钮

That is all the customizing we need to make each of these widgets work with WordPress perfectly. Now, you may have to customize the styling for it to work with your theme design. You are better of putting these codes above <?php the_content(); ?> code. You can also use our Smart Sharing Plugin, to display a floating icon down your window.

这就是我们需要做的所有自定义操作,以使这些小部件都能与WordPress完美配合。 现在,您可能必须自定义样式以使其与主题设计一起使用。 您最好将这些代码放在<?php the_content();之上 ?>代码。 您还可以使用我们的智能共享插件 ,在窗口下方显示一个浮动图标。

Do you have any other social media widgets that you would like to add? Let us know, and we can get the codes here. If you are using another widget and have the code ready, then please submit it to us, so others can benefit from it as well.

您还有其他社交媒体小部件要添加吗? 让我们知道,我们可以在这里获取代码。 如果您正在使用其他窗口小部件并准备好代码,请将其提交给我们,以便其他人也可以从中受益。

翻译自: https://www.wpbeginner.com/wp-themes/how-to-add-social-media-share-count-widgets-in-wordpress/

wordpress添加媒体

wordpress添加媒体_如何在WordPress中添加社交媒体共享计数小部件相关推荐

  1. html中p元素添加超链接_如何在HTML中添加超链接

    html中p元素添加超链接 How To Build a Website With HTML 如何使用HTML构建网站 This tutorial series will guide you thro ...

  2. chrome添加主题_如何在Chrome中添加和删除主题

    chrome添加主题 Google Chrome lets you personalize your experience with themes to make things a little mo ...

  3. wordpress添加媒体_如何在WordPress中添加新帖子并利用所有功能

    wordpress添加媒体 Are you trying to create a new post in WordPress? Do you want to learn about all the W ...

  4. wordpress标题设置_如何在WordPress中的帖子标题中添加赞助的帖子前缀

    wordpress标题设置 Often you see bloggers publish sponsored posts on their blog. Recently one of our user ...

  5. 符号在excel中的引用_如何在Excel中添加项目符号

    &符号在excel中的引用 There's no built-in feature for bullets in Excel, like there is in a Word document ...

  6. java soap 头_如何在Java中添加Soap标头

    我有一个来自oracle的NO.net Web服务,要访问,我需要添加soap标头.如何在Java中添加soap标头? Authenticator.setDefault(new ProxyAuthen ...

  7. cad添加自己线性_如何在CAD中添加自己编的线性

    如何在 CAD 中添加自己编的线性 一.线型的开发 1. 线型文件的定义格式 要开发出一套自己的线型, 我们可以先学习一下 AutoCAD 2000 本身本带的标 准线型文件,以便有所借鉴.我们找到 ...

  8. java注释中添加删除线_如何在Word中添加和删除注释

    java注释中添加删除线 Leaving comments in a Word document is a good way to leave feedback on a piece you're r ...

  9. java adt怎么使用_如何在eclipse中添加android ADT ADT插件的安装图文教程

    对于程序开发的学者来说,eclipse并不陌生,它为我们提供了一个非常广阔的平台来开发程序.同样我们也可以用它来开发android程序.但是在eclipse中并不能直接开发android程序,需要我们 ...

最新文章

  1. linux查看接口名,在linux下 怎么查看网络接口的名字? 网络接口的名字英文是什么呀?...
  2. QIIME 2用户文档. 5粪菌移植分析练习Fecal microbiota transplant (FMT) study
  3. 每日一皮:传说中的 10 大口头禅,你说过几个?
  4. 200米外遥测心跳定身份,五角大楼全新黑科技,人脸伪装也没用
  5. 成功解决Exception unhandled AttributeError 'MainWindow' object has no attribute 'setDaemon'
  6. 【转】mac os、linux及unix之间的关系
  7. AAAI 2021 | 上海交大提出基于有监督解耦的信息瓶颈算法
  8. Nginx的rewrite之if指令(一)
  9. java基础----Date、DateFormat
  10. mybatis-plus中 queryWrapper查询对象常见方法
  11. 痞子衡嵌入式:开启NXP-MCUBootUtility工具的BEE加密功能 - image_enc
  12. centos下python编程工具_CentOS下python的下载及安装
  13. 到底ResNet在解决一个什么问题呢?知乎热门回答
  14. 决策树算法原理(下)
  15. STM32工作笔记004---了解高速版PCB设计Cadence
  16. Series 入门(创建和增删改查)
  17. LeetCode 776. Split BST
  18. 列文伯格-马夸尔特拟合算法(Levenberg Marquardt Fitting)的C#实现
  19. background的认识(二)
  20. 数据库之如何解决SQL Server 2008 R2连接不上服务器?

热门文章

  1. 职工考勤信息管理系统(中南大学课程设计)
  2. 基于Eclipse开发的freemarker+SSM框架实现的体育比赛助手管理系统
  3. 手把手教你在C++中配置Gurobi
  4. 微信测试号实现微信分享等功能【转载】
  5. 这样自学Java,第一份工作我直接拿到了20K!
  6. Photoshop滤镜打造明星般飘逸头发
  7. arcmap 线矢量批量提取多图层剖面线
  8. java-面向对象中级-习题(通过继承实现员工工资核算打印功能 )
  9. 二本的2017秋招面经
  10. 微软智能手表专利曝光 主打健身追踪