<?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>活着 &#187; wordpress</title>
	<atom:link href="http://www.yetlive.com/tags/wordpress/feed" rel="self" type="application/rss+xml" />
	<link>http://www.yetlive.com</link>
	<description>活着就好，认真生活每一天</description>
	<lastBuildDate>Fri, 30 Dec 2011 13:17:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>How to Build a Quote Function in WordPress Theme</title>
		<link>http://www.yetlive.com/post/1104.html</link>
		<comments>http://www.yetlive.com/post/1104.html#comments</comments>
		<pubDate>Wed, 20 Jul 2011 02:23:34 +0000</pubDate>
		<dc:creator>认真生活</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.yetlive.com/?p=1104</guid>
		<description><![CDATA[Some times we need to quote others comments in our comment. So theme builder should consider to build this function in comments template. Here I want to share one solution to Build a Quote Function in WordPress Theme. First, we need to custom comment template in functions.php file. Then put this JS code to your [...]]]></description>
			<content:encoded><![CDATA[<p>Some times we need to quote others comments in our comment. So theme builder should consider to build this function in comments template. Here I want to share one solution to Build a Quote Function in <a href="http://www.yetlive.com/tags/wordpress" class="st_tag internal_tag" rel="tag" title="标签 wordpress 下的日志">WordPress</a> Theme.</p>
<p>First, we need to custom comment template in functions.<a href="http://www.yetlive.com/tags/php" class="st_tag internal_tag" rel="tag" title="标签 php 下的日志">php</a> file.</p>
<p>Then put this JS code to your wordpress theme:</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1104code3'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p11043"><td class="code" id="p1104code3"><pre class="php" style="font-family:monospace;"><span style="color: #009900;">&#40;</span><span style="color: #000000; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> $<span style="color: #009900;">&#40;</span>id<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">return</span> document<span style="color: #339933;">.</span>getElementById<span style="color: #009900;">&#40;</span>id<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
window<span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'RE'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
window<span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'RE'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'$'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> $<span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">function</span> quote<span style="color: #009900;">&#40;</span>authorId<span style="color: #339933;">,</span> commentId<span style="color: #339933;">,</span> commentBodyId<span style="color: #339933;">,</span> commentBox<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">var</span> author <span style="color: #339933;">=</span> RE<span style="color: #339933;">.</span>$<span style="color: #009900;">&#40;</span>authorId<span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>innerHTML<span style="color: #339933;">;</span>
	<span style="color: #000000; font-weight: bold;">var</span> comment <span style="color: #339933;">=</span> RE<span style="color: #339933;">.</span>$<span style="color: #009900;">&#40;</span>commentBodyId<span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>innerHTML<span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">var</span> insertStr <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&amp;lt; blockquote &amp;gt;'</span><span style="color: #339933;">;</span> insertStr <span style="color: #339933;">+=</span> <span style="color: #0000ff;">'\n&amp;lt; strong&amp;gt;&lt;a href=&quot;#'</span> <span style="color: #339933;">+</span> commentId <span style="color: #339933;">+</span> <span style="color: #0000ff;">'&quot;&gt;'</span> <span style="color: #339933;">+</span> author<span style="color: #339933;">.</span>replace<span style="color: #009900;">&#40;</span><span style="color: #339933;">/</span>\t<span style="color: #339933;">|</span>\n<span style="color: #339933;">|</span>\r\n<span style="color: #339933;">/</span>g<span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">'&lt;/a&gt;:'</span><span style="color: #339933;">;</span> insertStr <span style="color: #339933;">+=</span> comment<span style="color: #339933;">.</span>replace<span style="color: #009900;">&#40;</span><span style="color: #339933;">/</span>\t<span style="color: #339933;">/</span>g<span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> insertStr <span style="color: #339933;">+=</span> <span style="color: #0000ff;">'&amp;lt; /blockquote&amp;gt;\n'</span><span style="color: #339933;">;</span>
insertQuote<span style="color: #009900;">&#40;</span>insertStr<span style="color: #339933;">,</span> commentBox<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">function</span> insertQuote<span style="color: #009900;">&#40;</span>insertStr<span style="color: #339933;">,</span> commentBox<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>RE<span style="color: #339933;">.</span>$<span style="color: #009900;">&#40;</span>commentBox<span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;&amp;</span>amp<span style="color: #339933;">;</span> RE<span style="color: #339933;">.</span>$<span style="color: #009900;">&#40;</span>commentBox<span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span>type <span style="color: #339933;">==</span> <span style="color: #0000ff;">'textarea'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
field <span style="color: #339933;">=</span> RE<span style="color: #339933;">.</span>$<span style="color: #009900;">&#40;</span>commentBox<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span> alert<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;The comment box does not exist!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>document<span style="color: #339933;">.</span>selection<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
field<span style="color: #339933;">.</span>focus<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
sel <span style="color: #339933;">=</span> document<span style="color: #339933;">.</span>selection<span style="color: #339933;">.</span>createRange<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
sel<span style="color: #339933;">.</span>text <span style="color: #339933;">=</span> insertStr<span style="color: #339933;">;</span>
field<span style="color: #339933;">.</span>focus<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>field<span style="color: #339933;">.</span>selectionStart <span style="color: #339933;">||</span> field<span style="color: #339933;">.</span>selectionStart <span style="color: #339933;">==</span> <span style="color: #0000ff;">'0'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000000; font-weight: bold;">var</span> startPos <span style="color: #339933;">=</span> field<span style="color: #339933;">.</span>selectionStart<span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">var</span> endPos <span style="color: #339933;">=</span> field<span style="color: #339933;">.</span>selectionEnd<span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">var</span> cursorPos <span style="color: #339933;">=</span> startPos<span style="color: #339933;">;</span>
field<span style="color: #339933;">.</span>value <span style="color: #339933;">=</span> field<span style="color: #339933;">.</span>value<span style="color: #339933;">.</span>substring<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> startPos<span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> insertStr <span style="color: #339933;">+</span> field<span style="color: #339933;">.</span>value<span style="color: #339933;">.</span>substring<span style="color: #009900;">&#40;</span>endPos<span style="color: #339933;">,</span> field<span style="color: #339933;">.</span>value<span style="color: #339933;">.</span>length<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
cursorPos <span style="color: #339933;">+=</span> insertStr<span style="color: #339933;">.</span>length<span style="color: #339933;">;</span>
field<span style="color: #339933;">.</span>focus<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
field<span style="color: #339933;">.</span>selectionStart <span style="color: #339933;">=</span> cursorPos<span style="color: #339933;">;</span>
field<span style="color: #339933;">.</span>selectionEnd <span style="color: #339933;">=</span> cursorPos<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
field<span style="color: #339933;">.</span>value <span style="color: #339933;">+=</span> insertStr<span style="color: #339933;">;</span> field<span style="color: #339933;">.</span>focus<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
window<span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'RE_CON'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
window<span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'RE_CON'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'quote'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> quote<span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Then put a quote link in comments template.</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1104code4'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p11044"><td class="code" id="p1104code4"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>a onclick<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;RE_CON.quote('commentauthor-&lt;?php comment_ID() ?&gt;', '&lt; ?php echo <span style="color: #006699; font-weight: bold;">$add_below</span>-<span style="color: #006699; font-weight: bold;">$comment-&gt;comment_ID</span> ?&gt;', 'body-&lt;?php comment_ID() ?&gt;', 'comment');&quot;</span> href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;javascript:void(0);&quot;</span><span style="color: #339933;">&gt;</span> Quote <span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p><span style="color: #ff0000;">commentauthor-</span> and <span style="color: #ff0000;">body-</span> should be custom according to your template. You can even find some <a href="http://www.litecoupon.com/" target="_blank">discount coupon codes</a> to purchase software.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yetlive.com/post/1104.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Use Mail To Commenter Plugin in Threaded Comments</title>
		<link>http://www.yetlive.com/post/1102.html</link>
		<comments>http://www.yetlive.com/post/1102.html#comments</comments>
		<pubDate>Sun, 17 Jul 2011 01:22:38 +0000</pubDate>
		<dc:creator>认真生活</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.yetlive.com/?p=1102</guid>
		<description><![CDATA[Last post I told you to make wordpress theme support threaded comments. There is a simple idea. Copy the build-in template. But the idea can not work when you installed Mail to Commenter plugin and still want to use it in your threaded comments supported wordpress themes. So how to solve this problem? I&#8217;ll tell you [...]]]></description>
			<content:encoded><![CDATA[<p>Last post I told you to<a href="http://www.yetlive.com/post/1101.html"> make wordpress theme support threaded comments</a>. There is a simple idea. Copy the build-in template. But the idea can not work when you installed Mail to Commenter plugin and still want to use it in your threaded comments supported <a href="http://www.yetlive.com/tags/wordpress" class="st_tag internal_tag" rel="tag" title="标签 wordpress 下的日志">wordpress</a> themes. So how to solve this problem? I&#8217;ll tell you the solution to use <a href="http://wordpress.org/extend/plugins/mailtocommenter/" target="_blank">Mail to Commenter</a> plugin in threaded comments.</p>
<p>In the \wp-includes\comment-template.<a href="http://www.yetlive.com/tags/php" class="st_tag internal_tag" rel="tag" title="标签 php 下的日志">php</a> you will find the code:</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1102code10'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p110210"><td class="code" id="p1102code10"><pre class="php" style="font-family:monospace;">onclick<span style="color: #339933;">=</span><span style="color: #0000ff;">'return addComment.moveForm(\&quot;$add_below-$comment-&amp;gt;comment_ID\&quot;, \&quot;$comment-&amp;gt;comment_ID\&quot;, \&quot;$respond_id\&quot;, \&quot;$post-&amp;gt;ID\&quot;)'</span></pre></td></tr></table></div>

<p>So if you want to use start Mail to Commenters function, you should edit this line. But you should remember one point. You need to judge the threaded comments levels deep. Here is the judgement function:</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1102code11'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p110211"><td class="code" id="p1102code11"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$max_depth</span></pre></td></tr></table></div>

<p>So I get the idea now. Mail to Commenter plugin will check the comments if there is a @user or @user: in it. If it find one, it will mail to comment author. So we need to add a Javascript on the “Reply” link. Here is the JS code:</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1102code12'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p110212"><td class="code" id="p1102code12"><pre class="php" style="font-family:monospace;">RE_CON<span style="color: #339933;">.</span>reply<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&amp;lt; ?php echo $add_below-$comment-&amp;gt;comment_ID ?&amp;gt;'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'&amp;lt; ?php echo $comment-&amp;gt;comment_ID ?&amp;gt;'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'comment'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Then you should add this JS code to your theme:</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1102code13'); return false;">View Code</a> JAVASCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p110213"><td class="code" id="p1102code13"><pre class="javascript" style="font-family:monospace;"><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #003366; font-weight: bold;">function</span> $<span style="color: #009900;">&#40;</span>id<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000066; font-weight: bold;">return</span> document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span>id<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
window<span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'RE'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
window<span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'RE'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'$'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> $<span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">function</span> reply<span style="color: #009900;">&#40;</span>authorId<span style="color: #339933;">,</span> commentId<span style="color: #339933;">,</span> commentBox<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">var</span> author <span style="color: #339933;">=</span> RE.$<span style="color: #009900;">&#40;</span>authorId<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">innerHTML</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> insertStr <span style="color: #339933;">=</span> <span style="color: #3366CC;">'&lt;a href=&quot;#'</span> <span style="color: #339933;">+</span> commentId <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&quot;&gt;@'</span><span style="color: #339933;">+</span> author.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/\t|\n|\r\n/g</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #3366CC;">':&lt;/a&gt; <span style="color: #000099; font-weight: bold;">\n</span>'</span><span style="color: #339933;">;</span>
	insertReply<span style="color: #009900;">&#40;</span>insertStr<span style="color: #339933;">,</span> commentBox<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #003366; font-weight: bold;">function</span> insertReply<span style="color: #009900;">&#40;</span>insertStr<span style="color: #339933;">,</span> commentBox<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>RE.$<span style="color: #009900;">&#40;</span>commentBox<span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;&amp;</span>amp<span style="color: #339933;">;</span> RE.$<span style="color: #009900;">&#40;</span>commentBox<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">type</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">'textarea'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		field <span style="color: #339933;">=</span> RE.$<span style="color: #009900;">&#40;</span>commentBox<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;The comment box does not exist!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>field.<span style="color: #660066;">value</span>.<span style="color: #660066;">indexOf</span><span style="color: #009900;">&#40;</span>insertStr<span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;You've already appended this reply!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>field.<span style="color: #660066;">value</span>.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/\s|\t|\n/g</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		field.<span style="color: #660066;">value</span> <span style="color: #339933;">=</span> insertStr<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
		field.<span style="color: #660066;">value</span> <span style="color: #339933;">=</span> field.<span style="color: #660066;">value</span>.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/[\n]*$/g</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>'</span> <span style="color: #339933;">+</span> insertStr<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
window<span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'RE_CON'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
window<span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'RE_CON'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'reply'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> reply<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>After this, we are now able to use Mail to Commenters in our threaded comments. My solution to Use Mail To Commenter Plugin in Threaded Comments is like this:</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p1102code14'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p110214"><td class="code" id="p1102code14"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span> ?php <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'mailtocommenter_button'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>comment_reply_link<span style="color: #009900;">&#40;</span><span style="color: #990000;">array_merge</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$args</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'reply_text'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #0000ff;">'Reply'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'depth'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #000088;">$depth</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'max_depth'</span> <span style="color: #339933;">=&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #000088;">$args</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'max_depth'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>	<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'mailtocommenter_button'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;&amp;</span>amp<span style="color: #339933;">;</span> <span style="color: #000088;">$depth</span>
    <span style="color: #339933;">&lt;</span>a <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;comment-reply-link&quot;</span> onclick<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;onclick='return addComment.moveForm(' href=&quot;</span> rel<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;nofollow&quot;</span><span style="color: #339933;">&gt;</span>comment_ID<span style="color: #0000ff;">', '</span><span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span> ?php <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$add_below</span><span style="color: #339933;">-</span><span style="color: #000088;">$comment</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>comment_ID ?<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span><span style="color: #0000ff;">', '</span><span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span> ?php <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$respond_id</span> ?<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span><span style="color: #0000ff;">', '</span><span style="color: #339933;">&amp;</span>lt<span style="color: #339933;">;</span> ?php <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>ID ?<span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span><span style="color: #0000ff;">')'</span><span style="color: #339933;">;</span>RE_CON<span style="color: #339933;">.</span>reply<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&amp;lt; ?php echo $add_below-$comment-&amp;gt;comment_ID ?&amp;gt;'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'&amp;lt; ?php echo $comment-&amp;gt;comment_ID ?&amp;gt;'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'comment'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot;&amp;gt; &amp;lt; ?php _e('Reply'); ?&amp;gt; &lt;/a&gt;
    &amp;lt; ?php } else { ?&amp;gt;
    &lt;a class=&quot;</span>comment<span style="color: #339933;">-</span>reply<span style="color: #339933;">-</span><span style="color: #990000;">link</span><span style="color: #0000ff;">&quot; onclick=&quot;</span>RE_CON<span style="color: #339933;">.</span>reply<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&lt; ?php echo $add_below-$comment-&gt;comment_ID ?&gt;'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'&lt; ?php echo $comment-&gt;comment_ID ?&gt;'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'comment'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #0000ff;">&quot; href=&quot;</span>javascript<span style="color: #339933;">:</span>void<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #0000ff;">&quot; rel=&quot;</span>nofollow<span style="color: #0000ff;">&quot;&gt; &amp;lt; ?php _e('Reply'); ?&amp;gt; &lt;/a&gt;
    &lt;!--?php }?--&gt;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.yetlive.com/post/1102.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to make wordpress theme support threaded comment?</title>
		<link>http://www.yetlive.com/post/1101.html</link>
		<comments>http://www.yetlive.com/post/1101.html#comments</comments>
		<pubDate>Tue, 12 Jul 2011 13:16:36 +0000</pubDate>
		<dc:creator>认真生活</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[主题]]></category>

		<guid isPermaLink="false">http://www.yetlive.com/?p=1101</guid>
		<description><![CDATA[WordPress comments template is the most difficult part in building a wordpress theme. When it comes to make a threaded comments supported wordpress theme, comments template becomes more complex. However, there are many users like threaded comment as it show a clear relationship between each comments. There is a simple idea: copy the build-in template if [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.yetlive.com/tags/wordpress" class="st_tag internal_tag" rel="tag" title="标签 wordpress 下的日志">WordPress</a> comments template is the most difficult part in building a <a href="http://www.yetlive.com/tags/wordpress" class="st_tag internal_tag" rel="tag" title="标签 wordpress 下的日志">wordpress</a> theme. When it comes to make a threaded comments supported <a href="http://www.albamedia.net">wordpress</a> theme, comments template becomes more complex. However, there are many users like threaded comment as it show a clear relationship between each comments.</p>
<p>There is a simple idea: copy the build-in template if you are using a wordpress edition 2.7 or later. This methods may makes your template code not so harmonious with other parts. But if you don&#8217;t want to waste too much money on this part, you can use this method by just use the build-in function “<strong>wp_list_comments()</strong>” to display comments.</p>
<p>But I want to customize codes. Here is my solution to build a threaded comments supported wordpress theme.</p>
<p>Define customized comments codes in your wordpress theme file Function.<a href="http://www.yetlive.com/tags/php" class="st_tag internal_tag" rel="tag" title="标签 php 下的日志">php</a>. Then put this code into your comments.<a href="http://www.yetlive.com/tags/php" class="st_tag internal_tag" rel="tag" title="标签 php 下的日志">php</a> file: <strong>wp_list_comments(‘callback=custom_comments’)</strong></p>
<p>In the function.php file, I just added codes as follows:</p>
<pre>  $depth, 'max_depth' =&gt; $args['max_depth']))) ? &gt;</pre>
<p>The last step to show threaded comments is to turn on threaded comments support in “Discussion” tab in worpdress admin panel.</p>
<p>Based on many years of experience, <a href="http://www.lux-time.net/" target="_blank">Panerai Radiomir</a> have now become a top level brand watch. They are prepared to offer you the finest condition watches. It will makes you stand out among your friends.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yetlive.com/post/1101.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Start Gzip in .Htaccess to Speed Up Website</title>
		<link>http://www.yetlive.com/post/1091.html</link>
		<comments>http://www.yetlive.com/post/1091.html#comments</comments>
		<pubDate>Sat, 25 Jun 2011 14:17:14 +0000</pubDate>
		<dc:creator>认真生活</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[Speed Up]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.yetlive.com/?p=1091</guid>
		<description><![CDATA[Gzip is to compress your webpage on server in order to speed up your website. It will build a .gz zipped file on your server and then send it to webpage viewers. As the file is zipped, the download time will decrease a little. It also benefit for those websites which got a limited bandwidth. This post [...]]]></description>
			<content:encoded><![CDATA[<p>Gzip is to compress your webpage on server in order to <a href="http://www.yetlive.com/tags/speed-up" class="st_tag internal_tag" rel="tag" title="标签 Speed Up 下的日志">speed up</a> your website. It will build a .gz zipped file on your server and then send it to webpage viewers. As the file is zipped, the download time will decrease a little. It also benefit for those websites which got a limited bandwidth. This post will tell you how to start Gzip by edit .htaccess.</p>
<p>There is a build in function in <a href="http://www.yetlive.com/tags/wordpress" class="st_tag internal_tag" rel="tag" title="标签 wordpress 下的日志">WordPress</a> 2.5 and former edition. But 2.5 and over don&#8217;t added this function. So it&#8217;s the need to start Gzip by yourself. There are also some <a href="http://www.yetlive.com/tags/wordpress" class="st_tag internal_tag" rel="tag" title="标签 wordpress 下的日志">wordpress</a> plugin help users do Gzip. <a href="http://wordpress.org/extend/plugins/wp-super-cache/" target="_blank">Wp-Super-Cache</a> is one of these plugins. However, I don&#8217;t want to cache my index page. So the index page is not Gzipped. And the idea to start Gzip by edit .htaccess will solve this problem.</p>
<p>If your server support &#8216;mod_deflate&#8217; module, you can start Gzip by add this code to .htaccess file:</p>
<blockquote><p>&lt;ifmodule mod_deflate.c&gt;<br />
AddOutputFilter DEFLATE html xml <a href="http://www.yetlive.com/tags/php" class="st_tag internal_tag" rel="tag" title="标签 php 下的日志">php</a> js css<br />
&lt;/ifmodule&gt;</p></blockquote>
<p>If you installed WP Super Cache, you should turn off cache function in order to avoid conflict. I had used this idea on my website. It works fine on my site now.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yetlive.com/post/1091.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>博客中Tag的应用及其误区</title>
		<link>http://www.yetlive.com/post/1053.html</link>
		<comments>http://www.yetlive.com/post/1053.html#comments</comments>
		<pubDate>Sat, 11 Dec 2010 08:58:30 +0000</pubDate>
		<dc:creator>认真生活</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[seo]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[博客]]></category>
		<category><![CDATA[搜索引擎]]></category>

		<guid isPermaLink="false">http://www.yetlive.com/?p=1053</guid>
		<description><![CDATA[关于博客的标签应用，很多人可能会存在不同的误解。很多的SEO文章中都会介绍到要避免Wordpress中tag页被收录，从而减少重复内容，对于这样的说法，我曾经的做法就是在制作模板的过程中直接将Tag标签一项隐去，或者对Tag链接采用nofollow的策略，然而这样的做法其实是非常不利于搜索引擎优化的，本文就将介绍TAG标签的作用及其使用方法，提醒博主避免TAG应用的误区。 1、标签的第一个作用在于更精确的控制博客文章分类 tag很明显的一个作用在于补充Category的功能，在控制分类数量的同时更精确的归类所有博客文章，更方便读者分辨文章是否值得阅读，也更方便用户的搜索。 2、tag的作用在于利于Google的索引及对博客的自动归类 对于任何的网站，搜索引擎都有一个自动归类的过程。简单的比方如在Google或者其他搜索引擎中edu域名权重相对较高，关于内容方面则科技类站点权重较高。搜索引擎归类一个博客固然是根据文章内容来判断，然而在这一过程中，文章标签也有很大作用，设置良好的tag结构能够方便Google的识别，对于新站来说好处在于能够快速的跳出沙盒期。www.yetlive.com 3、在使用Tag的过程中如何避免重复页面 如上所述，tag的添加一定程度增加了搜索引擎收录重复内容的风险，这在很多的seo文章中是极力排斥的，然而Tag的好处是显而易见的，用户当然希望两者都能得到平衡。既然Wordpress或者Zblog等大量的博客系统都会提供Tag这样一个选项，自然会有其道理。 解决tag页面被收录其实也很简单，使用noindex即刻可。在Wordpress里面可以简单的利用判断语句判断页面是否是tag页，tag页则可以加入&#60;meta name=”robots” content=”noindex” /&#62;这样的标签从而有效控制tag页面被收录的问题。 SEO中常见误区：Noindex=网页不会被爬行 笔者曾经避免重复内容的做法就是在Tag链接中加入Nofollow标签，目的在于不让Google爬行tag页，从而控制tag页不被收录，这样的后果其实是让Google更难以理解博客结构，而如果能让tag页也让蜘蛛爬行则能令Google或者其他的搜索引擎更有效率的遍历网站所有的链接，避免重复收录同时让Google爬行的方式便是：noindex, follow。Follow你的tag标签但不收录tag页面。 对于noindex的作用，鄙人之前想当然的以为导致搜索引擎不爬行，然而根据资料，noindex的作用仅在于告诉搜索引擎不收录（百度可能会不遵守……），使用noindex的页面仍然会得到有效的爬行，于是对tag页使用nofollow标签能更好的利用整站的收录。 备注： 沙盒期：对于个人的理解，沙盒期其实是搜索引擎归类站点的一个时期。新站因为还来不及归类，相对权重都会较高 本站的Tag结构并不值得大家学习，本站在设置tag的过程中很大部分考虑了Tag标签不能太多的一个因素，因而导致tag结构不合理的后果。]]></description>
			<content:encoded><![CDATA[<p>关于博客的标签应用，很多人可能会存在不同的误解。很多的SEO文章中都会介绍到要避免Wordpress中tag页被收录，从而减少重复内容，对于这样的说法，我曾经的做法就是在制作模板的过程中直接将Tag标签一项隐去，或者对Tag链接采用nofollow的策略，然而这样的做法其实是非常不利于搜索引擎优化的，本文就将介绍TAG标签的作用及其使用方法，提醒博主避免TAG应用的误区。<span id="more-1053"></span></p>
<h3>1、标签的第一个作用在于更精确的控制博客文章分类</h3>
<p>tag很明显的一个作用在于补充Category的功能，在控制分类数量的同时更精确的归类所有博客文章，更方便读者分辨文章是否值得阅读，也更方便用户的搜索。</p>
<h3>2、tag的作用在于利于Google的索引及对博客的自动归类</h3>
<p>对于任何的网站，搜索引擎都有一个自动归类的过程。简单的比方如在Google或者其他搜索引擎中edu域名权重相对较高，关于内容方面则科技类站点权重较高。搜索引擎归类一个博客固然是根据文章内容来判断，然而在这一过程中，文章标签也有很大作用，设置良好的tag结构能够方便Google的识别，对于新站来说好处在于能够快速的跳出沙盒期。www.yetlive.com</p>
<h3>3、在使用Tag的过程中如何避免重复页面</h3>
<p>如上所述，tag的添加一定程度增加了搜索引擎收录重复内容的风险，这在很多的seo文章中是极力排斥的，然而Tag的好处是显而易见的，用户当然希望两者都能得到平衡。既然Wordpress或者Zblog等大量的博客系统都会提供Tag这样一个选项，自然会有其道理。</p>
<p>解决tag页面被收录其实也很简单，使用<strong>noindex</strong>即刻可。在Wordpress里面可以简单的利用判断语句判断页面是否是tag页，tag页则可以加入&lt;meta name=”robots” content=”noindex” /&gt;这样的标签从而有效控制tag页面被收录的问题。</p>
<h3>SEO中常见误区：Noindex=网页不会被爬行</h3>
<p>笔者曾经避免重复内容的做法就是在Tag链接中加入Nofollow标签，目的在于不让Google爬行tag页，从而控制tag页不被收录，这样的后果其实是让Google更难以理解博客结构，而如果能让tag页也让蜘蛛爬行则能令Google或者其他的搜索引擎更有效率的遍历网站所有的链接，避免重复收录同时让Google爬行的方式便是：<strong>noindex, follow</strong>。Follow你的tag标签但不收录tag页面。</p>
<p>对于noindex的作用，鄙人之前想当然的以为导致搜索引擎不爬行，然而根据资料，noindex的作用仅在于告诉搜索引擎不收录（百度可能会不遵守……），使用noindex的页面仍然会得到有效的爬行，于是对tag页使用nofollow标签能更好的利用整站的收录。</p>
<p><span style="color: #ff0000;">备注</span>：</p>
<p>沙盒期：对于个人的理解，沙盒期其实是搜索引擎归类站点的一个时期。新站因为还来不及归类，相对权重都会较高</p>
<p>本站的Tag结构并不值得大家学习，本站在设置tag的过程中很大部分考虑了Tag标签不能太多的一个因素，因而导致tag结构不合理的后果。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yetlive.com/post/1053.html/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>用WordPress短代码在博客任意部分添加广告</title>
		<link>http://www.yetlive.com/post/970.html</link>
		<comments>http://www.yetlive.com/post/970.html#comments</comments>
		<pubDate>Mon, 03 May 2010 01:26:41 +0000</pubDate>
		<dc:creator>认真生活</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[adsense]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[广告]]></category>

		<guid isPermaLink="false">http://www.yetlive.com/?p=970</guid>
		<description><![CDATA[其实不怎么满意现在文内广告的位置，本来是想通过判断WP中的more标签位置插入广告的，奈何自己总是很懒，加上毕业设计的任务压在头上，也就作罢了，忽然想起WP的短代码功能似乎可以实现此功能，于是翻了翻WordPress Popular Posts的代码，找出了此段代码，这样就可以轻松在博客文章或者WordPress侧栏中任意位置添加Adsense广告了。 代码很简单，把以下的代码加入到主题的functions.php中： function showad() { return &#8217;&#60;div class=”advertise”&#62; //这里放你的Adsense广告代码 &#60;/div&#62;&#8217;; } add_shortcode(&#8216;advertise&#8217;, &#8217;showad&#8217;); 然后在你想要植入Adsense广告的地方添加[advertise]即可。 通过以上简短的代码可以看出，add_shortcode();中第二个参数为需要添加的函数，第一个参数为使用短代码功能是方括号中应当包含的部分，而return ”语句的两个单引号之间可以放任何你想要放的代码，也就是说短代码不光能够控制广告的位置，也可以实现很多其他的功能，比如我现在用到的WordPress Popular Posts插件和Clean Archives Reloaded插件中都应用到了这个功能。]]></description>
			<content:encoded><![CDATA[<p>其实不怎么满意现在文内广告的位置，本来是想通过判断WP中的more标签位置插入广告的，奈何自己总是很懒，加上毕业设计的任务压在头上，也就作罢了，忽然想起WP的短代码功能似乎可以实现此功能，于是翻了翻<a href="http://wordpress.org/extend/plugins/wordpress-popular-posts/" target="_blank">WordPress Popular Posts</a>的代码，找出了此段代码，这样就可以轻松在博客文章或者<a href="http://www.yetlive.com/">WordPress</a>侧栏中任意位置添加Adsense广告了。<span id="more-970"></span></p>
<p>代码很简单，把以下的代码加入到主题的functions.php中：</p>
<blockquote><p>function showad() {<br />
 return &#8217;&lt;div class=”advertise”&gt;<br />
<span style="color: #ff0000;"> //这里放你的Adsense广告代码</span><br />
 &lt;/div&gt;&#8217;;<br />
 }<br />
 add_shortcode(&#8216;advertise&#8217;, &#8217;showad&#8217;);</p>
</blockquote>
<p>然后在你想要植入<a href="http://www.yetlive.com/tags/adsense">Adsense</a>广告的地方添加[advertise]即可。</p>
<p>通过以上简短的代码可以看出，add_shortcode();中第二个参数为需要添加的函数，第一个参数为使用短代码功能是方括号中应当包含的部分，而return ”语句的两个单引号之间可以放任何你想要放的代码，也就是说短代码不光能够控制<a href="http://www.yetlive.com/post/hide-your-adsense.html">广告的位置</a>，也可以实现很多其他的功能，比如我现在用到的<a href="http://wordpress.org/extend/plugins/wordpress-popular-posts/" target="_blank">WordPress Popular Posts</a>插件和<a href="http://wordpress.org/extend/plugins/clean-archives-reloaded/" target="_blank">Clean Archives Reloaded</a>插件中都应用到了这个功能。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yetlive.com/post/970.html/feed</wfw:commentRss>
		<slash:comments>41</slash:comments>
		</item>
		<item>
		<title>.htaccess中开启Gzip加速网页展示</title>
		<link>http://www.yetlive.com/post/968.html</link>
		<comments>http://www.yetlive.com/post/968.html#comments</comments>
		<pubDate>Wed, 28 Apr 2010 06:33:24 +0000</pubDate>
		<dc:creator>认真生活</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[seo]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.yetlive.com/?p=968</guid>
		<description><![CDATA[Gzip的作用简单点说起来就相当于将服务器上的文件压缩为一个.gz后缀的文件，类似将文件压缩成.zip格式，然后将.gz格式的文件再发送给浏览器，由于压缩后文件大小减少了很多，因而能起到提速的功能，也能减少服务器流量，对于页面文件比较大或者类似活着这种服务器在国外的时候，开启Gzip功能是很有效的加快网站打开速度的解决方法。本文会介绍的是在.htaccess中启用Gzip的方法。 WordPress2.5版本以前自带了Gzip功能，也就无需理会以下的操作，另外wordpress中还有些其他的插件能够实现此功能，如wp super cache就能设置开启Gzip提速。本站其实使用了wp super cache插件，然而为了能够保证首页能够在更新文章或评论后第一时间显示出来，也就并未缓存首页，于是首页速度就会下降。为了能够把所有的页面都通过Gzip提速，折腾了很久总算是找到了一个最简单的方法，在.htaccess中启用Gzip，比起php启用Gzip的方法绝对省事很多。 只要在.htaccess文件中加入如下片段即可，当然一下代码需要主机有mod_deflate模块： &#60;ifmodule mod_deflate.c&#62; AddOutputFilter DEFLATE html xml php js css &#60;/ifmodule&#62; 添加好以上的代码片段之后需要在WP Super Cache插件的后台设置中禁用压缩功能，因为.htaccess中的代码保证所有的文件都经过压缩了，这里不要重复做此步骤了。 目前本站所有页面都通过上述方法进行Gzip压缩了，各位有没有感觉到首页速度加快了呢？]]></description>
			<content:encoded><![CDATA[<p>Gzip的作用简单点说起来就相当于将服务器上的文件压缩为一个.gz后缀的文件，类似将文件压缩成.zip格式，然后将.gz格式的文件再发送给浏览器，由于压缩后文件大小减少了很多，因而能起到提速的功能，也能减少服务器流量，对于页面文件比较大或者类似<a href="http://www.yetlive.com">活着</a>这种服务器在国外的时候，开启Gzip功能是很有效的<a href="http://www.yetlive.com/post/speed-up.html">加快网站打开速度</a>的解决方法。本文会介绍的是在.htaccess中启用Gzip的方法。<span id="more-968"></span></p>
<p><a href="http://www.yetlive.com/tags/wordpress" class="st_tag internal_tag" rel="tag" title="标签 wordpress 下的日志">WordPress</a>2.5版本以前自带了Gzip功能，也就无需理会以下的操作，另外<a href="http://www.yetlive.com/">wordpress</a>中还有些其他的插件能够实现此功能，如wp super cache就能设置开启Gzip提速。本站其实使用了<a href="http://wordpress.org/extend/plugins/wp-super-cache/" target="_blank">wp super cache</a>插件，然而为了能够保证首页能够在更新文章或评论后第一时间显示出来，也就并未缓存首页，于是首页速度就会下降。为了能够把所有的页面都通过Gzip提速，折腾了很久总算是找到了一个最简单的方法，在.htaccess中启用Gzip，比起<a href="http://www.yetlive.com/tags/php">php</a>启用Gzip的方法绝对省事很多。</p>
<p>只要在.htaccess文件中加入如下片段即可，当然一下代码需要主机有mod_deflate模块：</p>
<blockquote><p>&lt;ifmodule mod_deflate.c&gt;<br />
AddOutputFilter DEFLATE html xml <a href="http://www.yetlive.com/tags/php" class="st_tag internal_tag" rel="tag" title="标签 php 下的日志">php</a> js css<br />
&lt;/ifmodule&gt;</p></blockquote>
<p>添加好以上的代码片段之后需要在<a href="http://wordpress.org/extend/plugins/wp-super-cache/" target="_blank">WP Super Cache</a>插件的后台设置中<span style="color: #ff0000;">禁用压缩功能</span>，因为.htaccess中的代码保证所有的文件都经过压缩了，这里不要重复做此步骤了。</p>
<p>目前本站所有页面都通过上述方法进行Gzip压缩了，各位有没有感觉到<a href="http://www.yetlive.com/post/speed-up.html" target="_blank">首页速度加快</a>了呢？</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yetlive.com/post/968.html/feed</wfw:commentRss>
		<slash:comments>25</slash:comments>
		</item>
		<item>
		<title>如何让WP主题同时支持嵌套评论与邮件回复</title>
		<link>http://www.yetlive.com/post/926.html</link>
		<comments>http://www.yetlive.com/post/926.html#comments</comments>
		<pubDate>Fri, 09 Apr 2010 07:35:13 +0000</pubDate>
		<dc:creator>认真生活</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.yetlive.com/?p=926</guid>
		<description><![CDATA[本着折腾到底不罢休的精神，又给博客做了个手术，这手术做的可不轻松，啃下了WP最艰难的部分。本次修改主要是为了支持嵌套回复，也是为了提高用户体验的一个重大举措吧，其实要纯粹的支持嵌套回复功能倒是简单，然而同时要正常使用ThinkAgain的Mail to Commenter插件来邮件回复的时候，问题就会随之而来了。昨晚折腾到半夜三点，终究是把问题给解决了。关键点在于如何让主题支持嵌套以及如何支持邮件回复。文章末尾有全套代码！ 让WP主题支持嵌套回复 首先要解决的是让主题嵌套回复，WP2.7版本后就支持此功能，这里可以参考mg12的WordPress 嵌套回复一文。最简单的方法是使用Wordpress自带的wp_list_comments()来自动解决，然而由于wp自带的wp_list_comments()代码稍嫌臃肿且无法自定义，这时候就需要在模板的function.php文件中来自定义评论显示方法，并在comments.php 中利用wp_list_comments(&#8216;callback=custom_comments&#8217;)来显示自定义评论。 在自定义的评论显示方法中，只需要添加如下代码即可： View Code PHP &#60; ?php comment_reply_link&#40;array_merge&#40; $args, array&#40;'depth' =&#62; $depth, 'max_depth' =&#62; $args&#91;'max_depth'&#93;&#41;&#41;&#41; ?&#62; 之后在后台设置中允许嵌套回复就可以了。 让回复功能支持Mail to Commenter插件的邮件回复 以上已经介绍了如何让主题支持嵌套回复了，然而以上的方法无法进行自定义，因此也就无法添加邮件回复所需的触发函数，于是我们需要对以上的方法进行适当的修改，通过研究代码，可以看到“回复”的链接实际上有类似这样的代码： View Code PHPonclick=&#34;addComment.moveForm('comment-&#60; ?php comment_ID() ?&#62;','&#60; ?php comment_ID() ?&#62;', 'respond', '&#60; ?php echo $post-&#62;ID; ?&#62;');&#34; 其中的&#8217;comment-< ?php comment_ID() ?>&#8216;会根据主题而不同例如WP自带的评论回复中该项就是&#8217;div-comment-&#8217;。而另外一个&#8217;respond&#8216;可能会根据不同主题不同，没有过多研究，各位可以自己尝试下。www.yetlive.com 也就是说自定义的时候只要修改下此处就好了，其中还要注意到的一个问题就是判断支持几层嵌套，当嵌套层数超出了WP后台设置的深度时则需要做相应处理，研究了WP的comment-template.php代码后，可以得到如下的方法判断是否已经超出嵌套层数： View Code PHP if&#40; $depth&#60;get_option&#40;'thread_comments_depth'&#41;&#41; 有了这些基础之后，就需要再为此回复链接带上邮件回复触发机制，大家知道Mail to Commenter插件会识别回复中是否存在@user [...]]]></description>
			<content:encoded><![CDATA[<p>本着折腾到底不罢休的精神，又给博客做了个手术，这手术做的可不轻松，啃下了WP最艰难的部分。本次修改主要是为了支持嵌套回复，也是为了提高用户体验的一个重大举措吧，其实要纯粹的支持嵌套回复功能倒是简单，然而同时要正常使用<a href="http://www.thinkagain.cn/" target="_blank">ThinkAgain</a>的<a href="http://wordpress.org/extend/plugins/mailtocommenter/" target="_blank">Mail to Commenter</a>插件来邮件回复的时候，问题就会随之而来了。昨晚折腾到半夜三点，终究是把问题给解决了。关键点在于如何让主题支持嵌套以及如何支持邮件回复。<span style="color: #ff0000;"><strong>文章末尾有全套代码</strong>！</span><span id="more-926"></span></p>
<h3>让WP主题支持嵌套回复</h3>
<p>首先要解决的是让主题嵌套回复，WP2.7版本后就支持此功能，这里可以参考mg12的<a href="http://www.neoease.com/wordpress-thread-comments/" target="_blank">WordPress 嵌套回复</a>一文。最简单的方法是使用Wordpress自带的wp_list_comments()来自动解决，然而由于wp自带的wp_list_comments()代码稍嫌臃肿且无法自定义，这时候就需要在模板的function.php文件中来自定义评论显示方法，并在comments.<a href="http://www.yetlive.com/tags/php" class="st_tag internal_tag" rel="tag" title="标签 php 下的日志">php</a> 中利用wp_list_comments(&#8216;callback=custom_comments&#8217;)来显示自定义评论。</p>
<p>在自定义的评论显示方法中，只需要添加如下代码即可：</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p926code21'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p92621"><td class="code" id="p926code21"><pre class="php" style="font-family:monospace;"> <span style="color: #339933;">&lt;</span> ?php comment_reply_link<span style="color: #009900;">&#40;</span><span style="color: #990000;">array_merge</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$args</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'depth'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$depth</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'max_depth'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$args</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'max_depth'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>之后在后台设置中允许嵌套回复就可以了。</p>
<h3>让回复功能支持Mail to Commenter插件的邮件回复</h3>
<p>以上已经介绍了如何让主题支持嵌套回复了，然而以上的方法无法进行自定义，因此也就无法添加邮件回复所需的触发函数，于是我们需要对以上的方法进行适当的修改，通过研究代码，<strong>可以看到“回复”的链接实际上有类似这样的代码</strong>：</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p926code22'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p92622"><td class="code" id="p926code22"><pre class="php" style="font-family:monospace;">onclick<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;addComment.moveForm('comment-&lt; ?php comment_ID() ?&gt;','&lt; ?php comment_ID() ?&gt;', 'respond', '&lt; ?php echo <span style="color: #006699; font-weight: bold;">$post-&gt;ID</span>; ?&gt;');&quot;</span></pre></td></tr></table></div>

<p>其中的&#8217;<span style="color: #ff0000;">comment</span>-< ?php comment_ID() ?>&#8216;会根据主题而不同例如WP自带的评论回复中该项就是&#8217;<span style="color: #ff0000;">div-comment</span>-&#8217;。而另外一个&#8217;<span style="color: #ff0000;">respond</span>&#8216;可能会根据不同主题不同，没有过多研究，各位可以自己尝试下。www.yetlive.com</p>
<p>也就是说自定义的时候只要修改下此处就好了，<strong>其中还要注意到的一个问题就是判断支持几层嵌套，当嵌套层数超出了WP后台设置的深度时则需要做相应处理</strong>，研究了WP的comment-template.php代码后，可以得到如下的方法判断是否已经超出嵌套层数：</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p926code23'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p92623"><td class="code" id="p926code23"><pre class="php" style="font-family:monospace;"> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$depth</span><span style="color: #339933;">&lt;</span>get_option<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'thread_comments_depth'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span></pre></td></tr></table></div>

<p>有了这些基础之后，就需要再为此回复链接带上邮件回复触发机制，大家知道Mail to Commenter插件会识别回复中是否存在@user 或者@user：来自动回复邮件，那么就需要为链接上加上一点Javascript代码让其有此功能，我研究了inove的JS代码后，借用如下：</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p926code24'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p92624"><td class="code" id="p926code24"><pre class="php" style="font-family:monospace;">RE_CON<span style="color: #339933;">.</span>reply<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'commentauthor-&lt; ?php comment_ID() ?&gt;'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'comment-&lt; ?php comment_ID() ?&gt;'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'comment'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>然后需要在主题的头部调用外部JS文件，此JS文件中加入如下代码：</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p926code25'); return false;">View Code</a> JAVASCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p92625"><td class="code" id="p926code25"><pre class="javascript" style="font-family:monospace;"><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #003366; font-weight: bold;">function</span> $<span style="color: #009900;">&#40;</span>id<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000066; font-weight: bold;">return</span> document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span>id<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
window<span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'RE'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
window<span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'RE'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'$'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> $<span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">function</span> reply<span style="color: #009900;">&#40;</span>authorId<span style="color: #339933;">,</span> commentId<span style="color: #339933;">,</span> commentBox<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">var</span> author <span style="color: #339933;">=</span> RE.$<span style="color: #009900;">&#40;</span>authorId<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">innerHTML</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> insertStr <span style="color: #339933;">=</span> <span style="color: #3366CC;">'&lt;a href=&quot;#'</span> <span style="color: #339933;">+</span> commentId <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&quot;&gt;@'</span><span style="color: #339933;">+</span> author.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/\t|\n|\r\n/g</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #3366CC;">':&lt;/a&gt; <span style="color: #000099; font-weight: bold;">\n</span>'</span><span style="color: #339933;">;</span>
	insertReply<span style="color: #009900;">&#40;</span>insertStr<span style="color: #339933;">,</span> commentBox<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #003366; font-weight: bold;">function</span> insertReply<span style="color: #009900;">&#40;</span>insertStr<span style="color: #339933;">,</span> commentBox<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>RE.$<span style="color: #009900;">&#40;</span>commentBox<span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span>amp<span style="color: #339933;">;&amp;</span>amp<span style="color: #339933;">;</span> RE.$<span style="color: #009900;">&#40;</span>commentBox<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">type</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">'textarea'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		field <span style="color: #339933;">=</span> RE.$<span style="color: #009900;">&#40;</span>commentBox<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;The comment box does not exist!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>field.<span style="color: #660066;">value</span>.<span style="color: #660066;">indexOf</span><span style="color: #009900;">&#40;</span>insertStr<span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;You've already appended this reply!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>field.<span style="color: #660066;">value</span>.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/\s|\t|\n/g</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		field.<span style="color: #660066;">value</span> <span style="color: #339933;">=</span> insertStr<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
		field.<span style="color: #660066;">value</span> <span style="color: #339933;">=</span> field.<span style="color: #660066;">value</span>.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/[\n]*$/g</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\n</span>'</span> <span style="color: #339933;">+</span> insertStr<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
window<span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'RE_CON'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
window<span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'RE_CON'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'reply'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> reply<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>之后，我们的嵌套回复于邮件回复功能就可以实现了。<span style="color: #ff0000;">于是我最终的方法就如下了，也是本主题中用到的方法</span>：</p>

<div class="wp_codebox_msgheader"><span class="right"></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p926code26'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p92626"><td class="code" id="p926code26"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span> ?php <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'mailtocommenter_button'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>comment_reply_link<span style="color: #009900;">&#40;</span><span style="color: #990000;">array_merge</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$args</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'reply_text'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Reply'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'depth'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$depth</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'max_depth'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$args</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'max_depth'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>	<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'mailtocommenter_button'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$depth</span><span style="color: #339933;">&lt;</span>get_option<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'thread_comments_depth'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
    <span style="color: #339933;">&lt;</span>a  rel<span style="color: #339933;">=</span><span style="color: #0000ff;">'nofollow'</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'comment-reply-link'</span> href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;javascript:void(0);&quot;</span> onclick<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;addComment.moveForm('comment-&lt;?php comment_ID() ?&gt;','&lt; ?php comment_ID() ?&gt;', 'respond', '&lt;?php echo <span style="color: #006699; font-weight: bold;">$post-&gt;ID</span>; ?&gt;');RE_CON.reply('commentauthor-&lt; ?php comment_ID() ?&gt;','comment-&lt; ?php comment_ID() ?&gt;','comment'); &quot;</span><span style="color: #339933;">&gt;</span>
    <span style="color: #339933;">&lt;</span> ?php _e<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Reply'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
    <span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;</span>
    <span style="color: #339933;">&lt;</span> ?php <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
    <span style="color: #339933;">&lt;</span>a  rel<span style="color: #339933;">=</span><span style="color: #0000ff;">'nofollow'</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'comment-reply-link'</span> href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;javascript:void(0);&quot;</span> onclick<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;RE_CON.reply('commentauthor-&lt; ?php comment_ID() ?&gt;','comment-&lt; ?php comment_ID() ?&gt;','comment'); &quot;</span><span style="color: #339933;">&gt;</span>
    <span style="color: #339933;">&lt;</span> ?php _e<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Reply'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
    <span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;</span>
    <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>其实在本人的修改中添加了对是否存在邮件回复插件的判断，其实如果是自己用的话不判断也可以，为了方便大家的使用才做了这样的处理，<span style="color: #ff0000;">至于说到JS文件，可以自己打开</span><a href="http://www.yetlive.com/wp-content/themes/simpleblue/js/common.js" target="_blank"><span style="color: #ff0000;">http://www.yetlive.com/wp-content/themes/simpleblue/js/common.js</span></a><span style="color: #ff0000;">复制粘贴</span>。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.yetlive.com/post/926.html/feed</wfw:commentRss>
		<slash:comments>32</slash:comments>
		</item>
	</channel>
</rss>

