tumblr

Just like Facebook’s Like Button, Send Button, Twitter’s Retweet Button, LinkedIn’s Share Button, Tumblr, a micro-blogging service, has launched their very own share button. The whole point of this button is to make it effortless for more than 16 million Tumblr bloggers to promote your content on their blogs. This share widget lets Tumblr users easily “Reblog” the content found all over the web rather than just on Tumblr. This reblog option is one of the key features behind the huge social aspect of Tumblr. In this article, we will show you how to add the Tumblr Share Button in WordPress.

就像Facebook的Like Button , Send Button , Twitter的Retweet Button , LinkedIn的Share Button ,微博客服务Tumblr一样,他们也推出了自己的共享按钮。 此按钮的全部目的是使超过1600万的Tumblr博客轻松地在其博客上推广您的内容。 通过此共享小部件,Tumblr用户可以轻松地“重新博客”在整个Web上找到的内容,而不仅仅是在Tumblr上。 此重博客选项是Tumblr巨大的社会方面背后的关键功能之一。 在本文中,我们将向您展示如何在WordPress中添加Tumblr共享按钮。

Previously, when we wrote about WordPress Post Formats that added micro-blogging functionalities into WordPress, we further elaborated on how this can actually allow WordPress to replace Tumblr for those users who want more control. We were bashed by email from various users saying “WordPress doesn’t let you have the social aspect that Tumblr does because it has a community of bloggers re-blogging your thing”. Well, now you can have that feature in your WordPress posts.

以前,当我们撰写有关WordPress帖子格式的文章时,在WordPress中添加了微博客功能,我们进一步阐述了它如何真正允许WordPress为需要更多控制的用户替换Tumblr。 众多用户发来的电子邮件让我们感到沮丧,他说:“ WordPress不允许您拥有Tumblr的社交功能,因为它有一个博客社区来重新博客您的东西”。 好了,现在您可以在WordPress帖子中拥有该功能。

First open up your footer.php file, and paste this code right above the </body> tag:

首先打开footer.php文件,并将此代码粘贴到</ body>标记上方:

<script type="text/javascript" src="http://platform.tumblr.com/v1/share.js"></script>

If you are using a framework, and you do not have access to the footer.php file, then add this code in your functions.php file or custom functions area:

如果您使用的是框架,并且您无权访问footer.php文件,则在您的functions.php文件或自定义函数区域中添加以下代码:

function insert_tumblr_script() {
echo '<script type="text/javascript" src="http://platform.tumblr.com/v1/share.js"></script>';
}
add_action('wp_footer', 'insert_tumblr_script');

Once you have done that, lets take a look at how you can add the code inside your posts:

完成之后,让我们看看如何在您的帖子中添加代码:

基本版本 (Basic Version)

To add the very basic version of the script which will suffice for most users, all you have to do is paste this code where you want in your loop which can be found in (single.php, index.php, page.php, loop.php etc):

要添加满足大多数用户需求的最基本的脚本版本,您所要做的就是将此代码粘贴到循环中所需的位置,该代码可以在(single.php,index.php,page.php,loop .php等):

<a href="http://www.tumblr.com/share" title="Share on Tumblr" style="display:inline-block; text-indent:-9999px; overflow:hidden; width:81px; height:20px; background:url('http://platform.tumblr.com/v1/share_1.png') top left no-repeat transparent;">Share on Tumblr</a>

You can have various versions of the share image which can be found on the official Tumblr Button page. You can basically select the image you want, and then paste the code from the basics. Alternatively, you can also put your own image for the share by replacing the background: css in the code above.

您可以拥有各种版本的共享图像,这些图像可以在Tumblr Button官方页面上找到 。 您基本上可以选择所需的图像,然后从基础知识中粘贴代码。 另外,您也可以通过替换背景来放置您自己的共享图像:上面代码中的css。

高级定制 (Advanced Customization)

Now as you know with the use of WordPress Post Formats, we are now seeing releases of Micro-Blogging Themes for WordPress. Well, in the basic version for Tumblr button that we discussed above, it pulls the content dynamically. This may cause errors like wrong title appearing, wrong description etc. Also in the basic version, it doesn’t pick the format (link, text, image, quote, video etc) for the Tumblr blogger unlike the Re-Blog function that is used in the Tumblr community.

如您所知,通过使用WordPress帖子格式 ,我们现在可以看到WordPress的微博客主题的发布。 好吧,在我们上面讨论的Tumblr按钮的基本版本中,它动态地提取内容。 这可能会导致错误,例如出现错误的标题,错误的描述等。同样在基本版本中,它不选择Tumblr博客的格式(链接,文本,图像,报价,视频等),这与Re-Blog功能不同,即在Tumblr社区中使用。

So the Tumblr share button made sure to built-in advanced functionalities that lets you specify the format of your post by default, specify the pre-filled description, a specific pull quote (complete with attribution) and even specific paragraphs from an article page. So here is an example of how you will add in your loop.php file utilizing the post formats in WordPress:

因此,Tumblr共享按钮可确保内置高级功能,该功能可让您默认指定帖子的格式,指定预填充的说明,特定的拉引号(带有署名)以及文章页面中的特定段落。 因此,这是一个示例,说明如何利用WordPress中的帖子格式添加loop.php文件:


if ( has_post_format( 'link' ) {
?>
<a href="http://www.tumblr.com/share/link?url=<?php echo urlencode(get_permalink()) ?>&name=<?php echo urlencode(get_the_title()) ?>&description=<?php echo urlencode(the_excerpt()) ?>" title="Share on Tumblr" style="display:inline-block; text-indent:-9999px; overflow:hidden; width:81px; height:20px; background:url('http://platform.tumblr.com/v1/share_1.png') top left no-repeat transparent;">Share on Tumblr</a>
<?php
} else if (has_post_format('quote')) { ?>
<a href="http://www.tumblr.com/share/quote?quote=<?php echo urlencode(get_the_content()) ?>&source=<?php echo urlencode(get_the_title()) ?>" title="Share on Tumblr" style="display:inline-block; text-indent:-9999px; overflow:hidden; width:81px; height:20px; background:url('http://platform.tumblr.com/v1/share_1.png') top left no-repeat transparent;">Share on Tumblr</a>
<?php
}else {
<a href="http://www.tumblr.com/share" title="Share on Tumblr" style="display:inline-block; text-indent:-9999px; overflow:hidden; width:81px; height:20px; background:url('http://platform.tumblr.com/v1/share_1.png') top left no-repeat transparent;">Share on Tumblr</a>
}

To read more about Customizations refer to the Official Tumblr Button Page.

要了解有关自定义的更多信息,请参阅Tumblr官方按钮页面 。

Will you be adding this button in your WordPress site?

您要在WordPress网站中添加此按钮吗?

翻译自: https://www.wpbeginner.com/wp-tutorials/how-to-add-the-tumblr-share-button-in-wordpress/

tumblr

tumblr_如何在WordPress中添加Tumblr共享按钮相关推荐

  1. wordpress添加媒体_如何在WordPress中添加社交媒体共享计数小部件

    wordpress添加媒体 Earlier on this blog, we created a Social Media Cheat Sheet for WordPress, but that on ...

  2. 如何在WordPress中添加Google Maps Store Locator

    Do you want to add Google Maps store locator in WordPress? A store locator is a map pointing to your ...

  3. wordpress 背景_如何在WordPress中添加全屏背景图片

    wordpress 背景 Full screen background image seems to be a new design trend that is becoming fashionabl ...

  4. wordpress图像大小_如何在WordPress中添加图像积分(逐步操作)

    wordpress图像大小 Recently, some of our readers asked us about how to properly add image credits in Word ...

  5. 如何在windows中添加smb共享

    如何在windows中添加smb共享 打开我的电脑 然后在电脑名字上点击鼠标右键,选择映射网络驱动器 打开后界面如图,输入开启smb共享的位置 打开我的电脑 在新版的操作系统中可能叫做这台电脑,打开后 ...

  6. wordpress添加媒体_如何在WordPress中添加jQuery FAQ手风琴

    wordpress添加媒体 Recently one of our users asked us if there was a way for them to add a FAQ accordion ...

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

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

  8. wordpress添加媒体_如何在WordPress中添加精选内容滑块

    wordpress添加媒体 Do you want to add a featured content slider like Yahoo or ESPN? Many popular sites us ...

  9. wordpress模板_如何在WordPress中添加漂亮的电子邮件模板

    wordpress模板 Do you want to change the appearance of emails sent by your WordPress site? By default, ...

  10. wordpress谷歌字体_如何在WordPress中添加Google Maps

    wordpress谷歌字体 You can add all kind of content into your WordPress site. At WPBeginner we have shown ...

最新文章

  1. 《学习opencv》笔记——矩阵和图像处理——cvMinManLoc,cvMul,cvNot,cvNorm and cvNormalize...
  2. k8s网络之Calico网络
  3. mysql 8.1初始密码_MySQL8.0安装之后查找默认密码
  4. 用C#编写网页小应用程序(Applet)
  5. 云计算的概念_云计算概念掀起涨停潮 美利云奠定板块龙头地位
  6. 使用 Visual Studio Code (VSCODE)写 C51 (持续更新 2018-04-09)
  7. html打开显示脚本错误,IE浏览器显示脚本错误怎么办 IE浏览器脚本错误解决方法图文教程...
  8. 开关造成的毛刺_LED射灯开关关了为什么还会闪
  9. Web 爬虫现已合法?
  10. matlab 图像中加入高斯白噪声,matlab – 使用imnoise为图像添加高斯噪声
  11. java写万年历_Java 实现万年历总结
  12. YOLOv5训练自己的数据集(超详细完整版)
  13. 检查pdf字体是否全部嵌入
  14. 综合项目之闪讯破解(五)之 如何用C#调用C++编写的Dll
  15. Python教学案例 - 三天打渔、两天晒网
  16. php和phalcon,PHP_phalcon框架使用指南,初次认识phalcon是在刚学php的时
  17. Airbnb NYC2019分析实战
  18. 如何在网站集成Payssion的国外支付方式?
  19. 红帽8使用nfs共享本地镜像
  20. STM32 外部中断详解(原理+配置代码)

热门文章

  1. 劝学篇翻译软件测试,《劝学篇》 全文、注释、翻译和赏析 - 可可诗词网
  2. 微软面向大众市场发布Office 2010
  3. Local package.json exists, but node_modules missing, did you mean to install?
  4. C#控制定位Word光标移动到任意行或者最后一行,取得光标位置等操作
  5. 基于android的手机选课系统的实现
  6. 2021年中国食糖产销量及重点企业对比分析[图]
  7. JAVA ZIP解压出现不可预料的压缩文件末端
  8. NMODBUS4.0源码下载地址
  9. Mybatis学习之一 引入dtd文件
  10. 南阳oj STL分类练习