<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>eddie.Yang's  creative &#187; twitter</title>
	<atom:link href="http://www.ediyang.com/tag/twitter/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ediyang.com</link>
	<description>Creative change lives</description>
	<lastBuildDate>Wed, 14 Jul 2010 02:06:12 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>15个Wordpress的Twitter技巧与插件</title>
		<link>http://www.ediyang.com/15-useful-twitter-hacks-and-plug-ins-for-wordpress/</link>
		<comments>http://www.ediyang.com/15-useful-twitter-hacks-and-plug-ins-for-wordpress/#comments</comments>
		<pubDate>Thu, 05 Mar 2009 06:24:36 +0000</pubDate>
		<dc:creator>eddie</dc:creator>
				<category><![CDATA[headline]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://www.ediyang.com/?p=350</guid>
		<description><![CDATA[Twitter自从2006成立以来被很多人誉为社会化媒体的革命.国内包括腾讯在内的互联网公司也跟着推出他们的Twitter服务.而在Wordpress这个最受欢迎的博客平台上,Twitter无疑是提升博客营销与成长的极好工具,那么我们应该怎么把Twitter与Wordpress结合起来呢?]]></description>
			<content:encoded><![CDATA[<p><a href="http://twitter.com">Twitter</a>自从2006成立以来被很多人誉为社会化媒体的革命.国内包括腾讯在内的互联网公司也跟着推出他们的Twitter服务.而在Wordpress这个最受欢迎的博客平台上,Twitter无疑是提升博客营销与成长的极好工具,那么我们应该怎么把Twitter与Wordpress结合起来呢?</p>
<h3>Hack技巧类</h3>
<h4>1.自动生成文章的TinyUrls（缩短网址）</h4>
<p>因为在Twitter碎碎念的时候最多只能输入140个字符,所以对文章网址进行缩短是一个比较好的方法.<br />
<img class="alignnone size-full wp-image-359" title="1" src="http://www.ediyang.com/wp-content/uploads/2009/03/1.png" alt="1 15个Wordpress的Twitter技巧与插件" width="463" height="146" /><br />
首先打开主题文件夹中的functions.php文件（如果没有的话就创建一个）</p>
<pre><code>
function getTinyUrl($url) {
    $tinyurl = file_get_contents("http://tinyurl.com/api-create.php?url=".$url);
    return $tinyurl;
}
</code></pre>
<p>接着把以下代码复制进你的single.php文件中,需要包含在The Loop内(我没有包含在The Loop里面,但是没问题)</p>
<pre><code>
&lt;?php
$turl = getTinyUrl(get_permalink($post-&gt;ID));
echo 'Tiny Url for this post: &lt;a href="'.$turl.'"&gt;'.$turl.'&lt;/a&gt;'
?&gt;
</code></pre>
<p>eddie:实际上这里只是演示一种方法,我们可以利用这个函数生成的缩短网址去干别的事,比如你看我这篇文章下方的Twitter按钮,点击进去显示的网址就是TinyUrl.</p>
<h4>2.不用插件,显示最新的Tweet</h4>
<p><img class="alignnone size-full wp-image-360" title="2" src="http://www.ediyang.com/wp-content/uploads/2009/03/2.png" alt="2 15个Wordpress的Twitter技巧与插件" width="500" height="195" /><br />
虽然可以使用插件来完成,但是对于这么简单的任务,我建议还是使用Hack而不是插件<br />
把以下代码复制进主题文件中(single.php等)</p>
<pre><code>&lt;?php

// Your twitter username.
$username = "TwitterUsername";

// Prefix - some text you want displayed before your latest tweet.
// (HTML is OK, but be sure to escape quotes with backslashes: for example href="link.html")
$prefix = "&lt;h2&gt;My last Tweet&lt;/h2&gt;";

// Suffix - some text you want display after your latest tweet. (Same rules as the prefix.)
$suffix = "";

$feed = "http://search.twitter.com/search.atom?q=from:" . $username . "&amp;rpp=1";

function parse_feed($feed) {
$stepOne = explode("&lt;content type="html"&gt;", $feed);
$stepTwo = explode("&lt;/content&gt;", $stepOne[1]);
$tweet = $stepTwo[0];
$tweet = str_replace("&amp;lt;", "&lt;", $tweet);
$tweet = str_replace("&amp;gt;", "&gt;", $tweet);
return $tweet;
}

$twitterFeed = file_get_contents($feed);
echo stripslashes($prefix) . parse_feed($twitterFeed) . stripslashes($suffix);
?&gt;
</code></pre>
<p>具体用法请看代码中的注释</p>
<h4>3.用一张图片显示你的Tweet</h4>
<p>只要你上<a href="http://www.twitsig.com/">TwitSig</a> 输入你的用户名,就可以得到一张上面有你最新Tweet的图片，你可以用这张图片用作论坛签名档等等.<br />
eddie:由于不支持中文显示，所以不详细说明用法.</p>
<h4>4.增加Tweet This的按钮</h4>
<p><img class="alignnone size-full wp-image-361" title="3" src="http://www.ediyang.com/wp-content/uploads/2009/03/3.png" alt="3 15个Wordpress的Twitter技巧与插件" width="500" height="190" /><br />
具体例子就是我网站下面的Twitter按钮了,按下去就会自动在你的Twitter中显示你正在阅读这篇文章.</p>
<pre><code>
&lt;a title="Click to send this page to Twitter!" href="http://twitter.com/home?status=
Currently reading &lt;?php the_permalink(); ?&gt;" target="_blank"&gt;

&lt;img src="send-to-twitter.png" alt="" /&gt;&lt;/a&gt;
</code></pre>
<p>请注意修改代码中img的路径</p>
<h4>5.识别来自Twitter的访问者</h4>
<p><img class="alignnone size-full wp-image-362" title="4" src="http://www.ediyang.com/wp-content/uploads/2009/03/4.png" alt="4 15个Wordpress的Twitter技巧与插件" width="428" height="215" /><br />
Twitter对于某些网站来说意味着10%的流量,因为用户通过你的Tweet访问你的网站,同时又在自己的Twitter中提交你的网址.那么当该访问者来自Twitter的时候我们可以通过以下代码显示一条欢迎信息.</p>
<pre><code>
&lt;?php
if (strpos("twitter.com",$_SERVER[HTTP_REFERER])==0) {
echo "Welcome, Twitter visitor! If you enjoy this post, don't hesitate to retweet!";
}
?&gt;
</code></pre>
<h4>6.创建一个Twitter页面</h4>
<p>这个对于做过主题的朋友来说很简单，就是创意一个模板文件. 首先在主题文件夹中新建一个文件,命名为twitter.php,然后把以下代码加进去.</p>
<pre><code>
&lt;?php

/*
Template Name: Twitter page
*/

get_header();

include_once(ABSPATH.WPINC.'/rss.php');
wp_rss('http://twitter.com/statuses/user_timeline/15985955.rss', 20);

get_sidebar();
get_footer();
?&gt;
</code></pre>
<h4>7.不用插件,把评论头像换成Twitter头像</h4>
<p><img class="alignnone size-full wp-image-367" title="12" src="http://www.ediyang.com/wp-content/uploads/2009/03/12.gif" alt="12 15个Wordpress的Twitter技巧与插件" width="500" height="197" /><br />
早在<a href="http://www.ediyang.com/30-most-wanted-wordpress-comments-page-hacks/">这里</a>我就介绍过使用Twitter头像替代默认的avatars头像的方法.方法大致如下:</p>
<p>1.从<a href="http://www.smashingmagazine.com/2009/01/08/twitter-avatars-in-comments-wordpress-plugin/">这里</a>下载funcions文件</p>
<p>2.解压文件并打开twittar.php,复制文件中全部代码进去你的functions.php文件里</p>
<p>3.现在打开你的comments.php文件并在comment loop中输入以下代码</p>
<h3>插件类</h3>
<h4>8.<a href="http://blog.victoriac.net/blog/twitter-updater">Twitter Updater</a></h4>
<p>当你发表了新文章时自动把链接发到Twitter中,并且可以定制你喜欢的文字.</p>
<h4>9.<a href="http://twitthis.com/">Twit this</a></h4>
<p><img class="alignnone size-full wp-image-368" title="22" src="http://www.ediyang.com/wp-content/uploads/2009/03/22.png" alt="22 15个Wordpress的Twitter技巧与插件" width="500" height="148" /><br />
可以说是上面第4个技巧的插件版,当然多了一个功能,用户可以输入自己喜欢的文字.</p>
<h4>10.<a href="http://www.jonbergan.com/2009/01/07/introducing-twit-it-up/">Twit it up</a></h4>
<p><img class="alignnone size-full wp-image-364" title="6-2" src="http://www.ediyang.com/wp-content/uploads/2009/03/6-2.png" alt="6 2 15个Wordpress的Twitter技巧与插件" width="500" height="129" /><br />
利用AJAX实现的功能与第9一样功能的插件.</p>
<h4>11.<a href="http://deanjrobinson.com/projects/twitt-twoo/">Twit-Twoo</a></h4>
<p>对于经常在Wordpress控制面板的朋友很有帮助的插件，因为它可以让你在控制面板中直接Tweet</p>
<h4>12.<a href="http://alexking.org/projects/wordpress/readme?project=twitter-tools">Twitter Tools</a></h4>
<p><img class="alignnone size-full wp-image-363" title="5" src="http://www.ediyang.com/wp-content/uploads/2009/03/5.png" alt="5 15个Wordpress的Twitter技巧与插件" width="500" height="216" /><br />
可以说是最受欢迎的Twitter插件之一了,因为它几乎涵盖了所有你可能需要的功能，包括上面某些提到的技巧.</p>
<h4>13.<a href="http://www.smashingmagazine.com/2009/01/08/twitter-avatars-in-comments-wordpress-plugin/">Twittar</a></h4>
<p><img class="alignnone size-full wp-image-365" title="6" src="http://www.ediyang.com/wp-content/uploads/2009/03/6.png" alt="6 15个Wordpress的Twitter技巧与插件" width="500" height="181" /><br />
没错，这个就是第7点我们用到的插件，如果你喜欢直接用插件而不是Hack,那你就使用这个吧</p>
<h4>14.<a href="http://www.smashingmagazine.com/2009/01/09/tweetbacks-plugin-for-wordpress/">Tweetbacks</a></h4>
<p><img class="alignnone size-full wp-image-366" title="7" src="http://www.ediyang.com/wp-content/uploads/2009/03/7.png" alt="7 15个Wordpress的Twitter技巧与插件" width="373" height="213" /><br />
Wordpress可以Trackbacks通知你别人在网站中链向了你的博客还是文章,但是如果有人在Twitter中顶了你的文章呢？你知道吗？是的,Tweetbacks人如其名,它会自动通知你并且可以在博客中显示出来.</p>
<h4>15.在哪?</h4>
<p>英文原文<a href="http://www.smashingmagazine.com/2009/03/04/15-useful-twitter-plugins-and-hacks-for-wordpress/">15 Useful Twitter Hacks and Plug-Ins For WordPress</a>（为什么我找不到第15个）</p>
<p>转载请注明来自<a href="http://www.ediyang.com">eddieYang&#8217;s creaive</a>谢谢.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ediyang.com/15-useful-twitter-hacks-and-plug-ins-for-wordpress/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->