Tumblr 是 Tumblr 版本的 Facebook 分享按钮,它的名字是“在 Tumblr 上分享” 被发表。我自己并不是 Tumblr 的大用户,但我决定尝试一下。
正如你所看到的,我能够成功反映它(谢谢@ikm!),但我仍然遇到了困难,因为没有太多信息,所以我将写一下如何在 WordPress 中安装 Share On Tumblr。基本上汤不热博客我按照其中写的步骤安装了它。
1.在body标签开始之前写入以下代码
就我而言,body 标记在 header.php 中开始,因此它是在此之前编写的。
<script type=text/javascript src=https://platform.tumblr.com/v1/share.js></script>
2. 在post.php中写入以下代码*请注意永久链接
我应该按照 Tumblr 博客上写的那样安装它,但我遇到了麻烦,因为 URL 永久链接没有经过 urlencoded,而且我无法正确发送 URL。经过各种尝试和错误的结果,似乎get_permalink(get_the_ID()))看来如果不这样写,就无法正确urlencoded和回显。 PHP 很难。
<a href=https://www.tumblr.com/share/link?url=<?php echo urlencode(get_permalink(get_the_ID())) ?>&name=<?php echo urlencode(get_the_title()) ?>&description=<?php echo urlencode( ) ?> title=Share on Tumblr style=display:inline-block; text-indent:-9999px; overflow:hidden; width:20px; height:20px; background:url('https://platform.tumblr.com/v1/share_4.png') top left no-repeat transparent; vertical-align:top;>Share on Tumblr</a>
【2011.05.12 21:07 更新】
看来有些代码有误,给您带来的不便,敬请谅解。如果您使用以下内容,则不会出现错误,并且您将能够正确发布描述。感谢@sanojimaru 指出并纠正它! !
WordPress 添加 tumblr 按钮|sanojimaru.com
<a href=https://www.tumblr.com/share/link?url=<?php echo urlencode(get_permalink(get_the_ID())) ?>&name=<?php echo urlencode(get_the_title()) ?>&description=<?php echo urlencode(mb_substr(strip_tags(get_the_content()), 0, 140))?> title=Share on Tumblr style=display:inline-block; text-indent:-9999px; overflow:hidden; width:20px; height:20px; background:url('https://platform.tumblr.com/v1/share_4.png') top left no-repeat transparent; vertical-align:top;>Share on Tumblr</a>
如果您正在使用 WordPress 并且想引入 Tumblr 按钮,请参考!
(通过TechCrunch)
